]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
test: Remove possible infinite loop in virnetsockettest
authorJohn Ferlan <jferlan@redhat.com>
Fri, 7 Sep 2018 12:20:15 +0000 (08:20 -0400)
committerJohn Ferlan <jferlan@redhat.com>
Tue, 11 Sep 2018 14:47:20 +0000 (10:47 -0400)
Commit 39015a6f3 modified the test to be more reliable/realistic,
but without checking the return status of virEventRunDefaultImpl
it's possible that the test could run infinitely.

Found by Coverity

Signed-off-by: John Ferlan <jferlan@redhat.com>
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
tests/virnetsockettest.c

index cccb90d0be793cbd645f5ea3691927988df231f4..5927be1f80a989f59a9a3897b8bc8b9ecef53b49 100644 (file)
@@ -243,8 +243,10 @@ testSocketAccept(const void *opaque)
                         &cdata) < 0)
         goto cleanup;
 
-    while (rsock == NULL)
-        virEventRunDefaultImpl();
+    while (rsock == NULL) {
+        if (virEventRunDefaultImpl() < 0)
+            break;
+    }
 
     for (i = 0; i < nlsock; i++) {
         if (lsock[i] == rsock) {