Signed-off-by: Martin Kletzander <mkletzan(a)redhat.com>
---
src/rpc/virnetsocket.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/rpc/virnetsocket.c b/src/rpc/virnetsocket.c
index 586a0d7..42184bd 100644
--- a/src/rpc/virnetsocket.c
+++ b/src/rpc/virnetsocket.c
@@ -574,13 +574,14 @@ int virNetSocketNewConnectUNIX(const char *path,
retry:
if (connect(fd, &remoteAddr.data.sa, remoteAddr.len) < 0) {
+ int status = 0;
+ pid_t pid = 0;
+
if (!spawnDaemon) {
virReportSystemError(errno, _("Failed to connect socket to
'%s'"),
path);
goto error;
- } else {
- int status = 0;
- pid_t pid = 0;
+ }
if ((passfd = socket(PF_UNIX, SOCK_STREAM, 0)) < 0) {
virReportSystemError(errno, "%s", _("Failed to create
socket"));
@@ -634,7 +635,6 @@ int virNetSocketNewConnectUNIX(const char *path,
if (virNetSocketForkDaemon(binary, passfd) < 0)
goto error;
}
- }
localAddr.len = sizeof(localAddr.data);
if (getsockname(fd, &localAddr.data.sa, &localAddr.len) < 0) {
--
2.1.0