From c062fa2fa977695301aed8f27eecf7ce4e546fd9 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Fri, 18 Sep 2015 12:05:44 +0200 Subject: [PATCH] client: fix binding of Unix socket on Solaris bind() needs to be called before connect(), otherwise it fails with EINVAL. --- client.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/client.c b/client.c index 39b5d448..60f53fcd 100644 --- a/client.c +++ b/client.c @@ -209,11 +209,6 @@ prepare_socket(union sockaddr_all *addr) return 0; } - if (connect(sock_fd, &addr->sa, addr_len) < 0) { - DEBUG_LOG(LOGF_Client, "Could not connect socket : %s", strerror(errno)); - return 0; - } - if (addr->sa.sa_family == AF_UNIX) { struct sockaddr_un sa_un; @@ -242,6 +237,11 @@ prepare_socket(union sockaddr_all *addr) } } + if (connect(sock_fd, &addr->sa, addr_len) < 0) { + DEBUG_LOG(LOGF_Client, "Could not connect socket : %s", strerror(errno)); + return 0; + } + return 1; } -- 2.47.2