diff options
Diffstat (limited to 'ext/socket/unixsocket.c')
-rw-r--r-- | ext/socket/unixsocket.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/socket/unixsocket.c b/ext/socket/unixsocket.c index 907f89cc49..4c3c5a7f7a 100644 --- a/ext/socket/unixsocket.c +++ b/ext/socket/unixsocket.c @@ -65,7 +65,12 @@ rsock_init_unixsock(VALUE sock, VALUE path, int server) rb_sys_fail(sockaddr.sun_path); } - if (server) listen(fd, 5); + if (server) { + if (listen(fd, 5) < 0) { + close(fd); + rb_sys_fail("listen(2)"); + } + } rsock_init_sock(sock, fd); if (server) { |