]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: Wait for monitor socket even without pid
authorViktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
Mon, 26 Nov 2012 14:17:12 +0000 (15:17 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Wed, 28 Nov 2012 14:54:21 +0000 (14:54 +0000)
If qemuMonitorOpenUnix is called without a related pid, i.e. for
QMP probing, a connect failure can happen as the result of a race.
Without a pid there is no retry and thus we give up too early.
This changes the code to retry if no pid is supplied.

Signed-off-by: Viktor Mihajlovski <mihajlov@linux.vnet.ibm.com>
src/qemu/qemu_monitor.c

index cbde2b160799d2b407dfd5a2ed8db84fad01e8fc..fe8424f9a99551136a8b26053fcbd5897c62b2d1 100644 (file)
@@ -283,7 +283,7 @@ qemuMonitorOpenUnix(const char *monitor, pid_t cpid)
             break;
 
         if ((errno == ENOENT || errno == ECONNREFUSED) &&
-            cpid && virProcessKill(cpid, 0) == 0) {
+            (!cpid || virProcessKill(cpid, 0) == 0)) {
             /* ENOENT       : Socket may not have shown up yet
              * ECONNREFUSED : Leftover socket hasn't been removed yet */
             continue;