mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 15:15:25 +00:00
Fix check for socket existance / daemon spawn
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>
This commit is contained in:
parent
ebbcc02639
commit
54c4d9d90b
@ -502,7 +502,11 @@ int virNetSocketNewConnectUNIX(const char *path,
|
|||||||
|
|
||||||
retry:
|
retry:
|
||||||
if (connect(fd, &remoteAddr.data.sa, remoteAddr.len) < 0) {
|
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 &&
|
if (retries == 0 &&
|
||||||
virNetSocketForkDaemon(binary) < 0)
|
virNetSocketForkDaemon(binary) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
|
Loading…
Reference in New Issue
Block a user