diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 1fb0eca2d5483a7cb01c944db026f9f759814c0f..755275ab9dcb61e8e4642bc06a2928f1eb823431 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -321,6 +321,7 @@ doRemoteOpen (virConnectPtr conn, trans_ext, trans_tcp, } transport; + const char *daemonPath; /* We handle *ALL* URIs here. The caller has rejected any * URIs we don't care about */ @@ -588,9 +589,14 @@ doRemoteOpen (virConnectPtr conn, VIR_DEBUG("Proceeding with sockname %s", sockname); } + if (!(daemonPath = remoteFindDaemonPath())) { + remoteError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Unable to locate libvirtd daemon in $PATH")); + goto failed; + } if (!(priv->client = virNetClientNewUNIX(sockname, flags & VIR_DRV_OPEN_REMOTE_AUTOSTART, - remoteFindDaemonPath()))) + daemonPath))) goto failed; priv->is_secure = 1; diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c index 2747f66c6fcebf8b89a5b346d4c6e6709b41bd09..af4fc5e9a7cdd00fa5c52c8e3854d18636496c5b 100644 --- a/src/rpc/virnetsocket.c +++ b/src/rpc/virnetsocket.c @@ -481,6 +481,12 @@ int virNetSocketNewConnectUNIX(const char *path, remoteAddr.len = sizeof(remoteAddr.data.un); + if (spawnDaemon && !binary) { + virNetError(VIR_ERR_INTERNAL_ERROR, + _("Auto-spawn of daemon requested, but no binary specified")); + return -1; + } + if ((fd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) { virReportSystemError(errno, "%s", _("Failed to create socket")); goto error;