summaryrefslogtreecommitdiff
path: root/ext/socket/unixsocket.c
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-04-09 14:53:19 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2010-04-09 14:53:19 +0000
commit79a3b7797f559d3aa41816368c8a3c1fb26f4530 (patch)
tree8bf6a243ba76759541f737c63c120aa3353175e7 /ext/socket/unixsocket.c
parentc13142643d846b3805296babf81f81791378122d (diff)
* ext/socket/ipsocket.c (init_inetsock_internal),
ext/socket/unixsocket.c (rsock_init_unixsock): check the result of listen(2). based on a patch from Mike Pomraning. [ruby-core:23698] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27272 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/socket/unixsocket.c')
-rw-r--r--ext/socket/unixsocket.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/ext/socket/unixsocket.c b/ext/socket/unixsocket.c
index 907f89c..4c3c5a7 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) {