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 <mihajlov@linux.vnet.ibm.com>
This commit is contained in:
Viktor Mihajlovski 2012-11-26 15:17:12 +01:00 committed by Daniel P. Berrange
parent df33ecdd9e
commit 7a95eccc81

View 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;