From: Daniel P. Berrange Date: Fri, 25 May 2012 13:54:31 +0000 (+0100) Subject: Fix check for socket existance / daemon spawn X-Git-Tag: v0.9.13-rc1~197 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=54c4d9d90bf9f9583e0db89232671c1801c61142;p=thirdparty%2Flibvirt.git Fix check for socket existance / daemon spawn When you try to connect to a socket in the abstract namespace, the error will be ECONNREFUSED for a non-listening daemon. With the non-abstract namespace though, you instead get ENOENT. Add a check for this extra errno when auto-spawning the daemon Signed-off-by: Daniel P. Berrange --- diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c index fa16d31f20..0b32ffeee4 100644 --- a/src/rpc/virnetsocket.c +++ b/src/rpc/virnetsocket.c @@ -502,7 +502,11 @@ int virNetSocketNewConnectUNIX(const char *path, retry: if (connect(fd, &remoteAddr.data.sa, remoteAddr.len) < 0) { - if (errno == ECONNREFUSED && spawnDaemon && retries < 20) { + if ((errno == ECONNREFUSED || + errno == ENOENT) && + spawnDaemon && retries < 20) { + VIR_DEBUG("Connection refused for %s, trying to spawn %s", + path, binary); if (retries == 0 && virNetSocketForkDaemon(binary) < 0) goto error;