From: Viktor Mihajlovski Date: Mon, 26 Nov 2012 14:17:12 +0000 (+0100) Subject: qemu: Wait for monitor socket even without pid X-Git-Tag: CVE-2012-3411~42 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7a95eccc816cfd37377d2fcf3978522c50c072b8;p=thirdparty%2Flibvirt.git qemu: Wait for monitor socket even without pid 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 --- diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index cbde2b1607..fe8424f9a9 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -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;