]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
Fix check for socket existance / daemon spawn
authorDaniel P. Berrange <berrange@redhat.com>
Fri, 25 May 2012 13:54:31 +0000 (14:54 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Mon, 28 May 2012 09:43:09 +0000 (10:43 +0100)
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 <berrange@redhat.com>
src/rpc/virnetsocket.c

index fa16d31f204905bc87e4ce9330631e7b6461f7d0..0b32ffeee42344baa7262a09eb3df2e27eec49f5 100644 (file)
@@ -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;