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.
This commit is contained in:
Daniel P. Berrange 2015-07-03 16:51:56 +01:00
parent 54012746ae
commit 406ee8c226

View 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;