From: John Ferlan Date: Fri, 7 Sep 2018 12:20:15 +0000 (-0400) Subject: test: Remove possible infinite loop in virnetsockettest X-Git-Tag: v4.8.0-rc1~225 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a0ba31c0069e89f178f064e724ddbc8540b64d32;p=thirdparty%2Flibvirt.git test: Remove possible infinite loop in virnetsockettest 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 ACKed-by: Michal Privoznik --- diff --git a/tests/virnetsockettest.c b/tests/virnetsockettest.c index cccb90d0be..5927be1f80 100644 --- a/tests/virnetsockettest.c +++ b/tests/virnetsockettest.c @@ -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) {