From: Daniel P. Berrange Date: Fri, 3 Jul 2015 15:51:56 +0000 (+0100) Subject: rpc: ensure daemon is spawn even if dead socket exists X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fe40b1d1d45e0926b8cd6ada2676855cd19e04a9;p=thirdparty%2Flibvirt.git rpc: ensure daemon is spawn even if dead socket exists 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) --- diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c index 51f94d4bf1..6153e0e7cb 100644 --- a/src/rpc/virnetsocket.c +++ b/src/rpc/virnetsocket.c @@ -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;