summaryrefslogtreecommitdiff
path: root/ext/socket/unixsocket.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/socket/unixsocket.c')
-rw-r--r--ext/socket/unixsocket.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/socket/unixsocket.c b/ext/socket/unixsocket.c
index 2442bc1d12..f73f12777c 100644
--- a/ext/socket/unixsocket.c
+++ b/ext/socket/unixsocket.c
@@ -65,14 +65,16 @@ rsock_init_unixsock(VALUE sock, VALUE path, int server)
}
if (status < 0) {
+ int e = errno;
close(fd);
- rsock_sys_fail_path("connect(2)", path);
+ rsock_syserr_fail_path(e, "connect(2)", path);
}
if (server) {
if (listen(fd, SOMAXCONN) < 0) {
+ int e = errno;
close(fd);
- rsock_sys_fail_path("listen(2)", path);
+ rsock_syserr_fail_path(e, "listen(2)", path);
}
}