]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
rpc: ensure daemon is spawn even if dead socket exists
authorDaniel P. Berrange <berrange@redhat.com>
Fri, 3 Jul 2015 15:51:56 +0000 (16:51 +0100)
committerCole Robinson <crobinso@redhat.com>
Thu, 21 Jan 2016 00:10:00 +0000 (19:10 -0500)
The auto-spawn code would originally attempt to spawn the
daemon for both ENOENT and ECONNREFUSED errors from connect().
The various refactorings eventually lost this so we only
spawn the daemon on ENOENT. The result is if the daemon exits
uncleanly, so that the socket is left in the filesystem, we
will never be able to auto-spawn the daemon again.

(cherry picked from commit 406ee8c226d2197ba1aaecb9cf3ad2b6df31ae44)

src/rpc/virnetsocket.c

index 51f94d4bf1d7453e2cd2f82ecac94e7a26b7c7a4..6153e0e7cbccae1d43ef7bedaaba71716ce0ad98 100644 (file)
@@ -610,7 +610,8 @@ int virNetSocketNewConnectUNIX(const char *path,
 
     while (retries &&
            connect(fd, &remoteAddr.data.sa, remoteAddr.len) < 0) {
-        if (!(spawnDaemon && errno == ENOENT)) {
+        if (!(spawnDaemon && (errno == ENOENT ||
+                              errno == ECONNREFUSED))) {
             virReportSystemError(errno, _("Failed to connect socket to '%s'"),
                                  path);
             goto cleanup;