summaryrefslogtreecommitdiff
path: root/ext/socket/ipsocket.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/ipsocket.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/ipsocket.c')
-rw-r--r--ext/socket/ipsocket.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/ext/socket/ipsocket.c b/ext/socket/ipsocket.c
index 447ae40db6..b6b2426e97 100644
--- a/ext/socket/ipsocket.c
+++ b/ext/socket/ipsocket.c
@@ -104,8 +104,13 @@ init_inetsock_internal(struct inetsock_arg *arg)
arg->fd = -1;
- if (type == INET_SERVER)
- listen(fd, 5);
+ if (type == INET_SERVER) {
+ status = listen(fd, 5);
+ if (status < 0) {
+ close(fd);
+ syscall = "listen(2)";
+ }
+ }
/* create new instance */
return rsock_init_sock(arg->sock, fd);