]> xenbits.xensource.com Git - people/liuw/libxenctrl-split/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)
committerDaniel P. Berrange <berrange@redhat.com>
Fri, 17 Jul 2015 11:46:43 +0000 (12:46 +0100)
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.

src/rpc/virnetsocket.c

index 3d7508110ef2a846e1e76ed92c910520a4f7a209..106d09aaf971422af82a2ecd383f1203f0323a97 100644 (file)
@@ -681,7 +681,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;