diff options
author | Damien Miller <djm@mindrot.org> | 2023-03-31 14:17:22 +1100 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2023-03-31 14:17:22 +1100 |
commit | a4c1c2513e36f111eeaa1322c510067930e5e51e (patch) | |
tree | a0045e9897ac7439ffe0cf77b05101a3cba8f5d5 /channels.c | |
parent | 34ee842cdd981a759fe8f0d4a37521f9a1c63170 (diff) |
don't call connect() on negative socket
Coverity CID 405037
Diffstat (limited to 'channels.c')
-rw-r--r-- | channels.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -5045,8 +5045,10 @@ connect_local_xsocket_path(const char *pathname) struct sockaddr_un addr; sock = socket(AF_UNIX, SOCK_STREAM, 0); - if (sock == -1) + if (sock == -1) { error("socket: %.100s", strerror(errno)); + return -1; + } memset(&addr, 0, sizeof(addr)); addr.sun_family = AF_UNIX; strlcpy(addr.sun_path, pathname, sizeof addr.sun_path); |