diff options
author | default <nobody@localhost> | 2024-08-05 06:01:21 +0200 |
---|---|---|
committer | default <nobody@localhost> | 2024-08-05 06:01:21 +0200 |
commit | 972c3dc5d43a114ae59386d4edfdfb8ce0f3793e (patch) | |
tree | 2568b6190dc0ca34478ccabc1191e504d1e8cfcf /xs_socket.h | |
parent | e9b108a6e0f09d74ee605f1a854ecbdc12a65c92 (diff) |
Added support for listening on unix sockets.
Diffstat (limited to 'xs_socket.h')
-rw-r--r-- | xs_socket.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/xs_socket.h b/xs_socket.h index 1c73a22..1bd053a 100644 --- a/xs_socket.h +++ b/xs_socket.h @@ -182,8 +182,10 @@ int xs_socket_connect(const char *addr, const char *serv) host.sin_port = htons(atoi(serv)); if ((d = socket(AF_INET, SOCK_STREAM, 0)) != -1) { - if (connect(d, (struct sockaddr *)&host, sizeof(host)) == -1) + if (connect(d, (struct sockaddr *)&host, sizeof(host)) == -1) { + close(d); d = -1; + } } } |