ruby-changes:15380
From: mame <ko1@a...>
Date: Fri, 9 Apr 2010 23:53:35 +0900 (JST)
Subject: [ruby-changes:15380] Ruby:r27272 (trunk): * ext/socket/ipsocket.c (init_inetsock_internal),
mame 2010-04-09 23:53:19 +0900 (Fri, 09 Apr 2010) New Revision: 27272 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=27272 Log: * 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] Modified files: trunk/ChangeLog trunk/ext/socket/ipsocket.c trunk/ext/socket/unixsocket.c Index: ChangeLog =================================================================== --- ChangeLog (revision 27271) +++ ChangeLog (revision 27272) @@ -1,3 +1,9 @@ +Fri Apr 9 23:51:45 2010 Yusuke Endoh <mame@t...> + + * 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] + Fri Apr 9 21:22:10 2010 Keiju Ishitsuka <keiju@r...> * lib/irb/completion.rb (CompletionProc): irb will be stuck with Index: ext/socket/ipsocket.c =================================================================== --- ext/socket/ipsocket.c (revision 27271) +++ ext/socket/ipsocket.c (revision 27272) @@ -104,8 +104,13 @@ 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); Index: ext/socket/unixsocket.c =================================================================== --- ext/socket/unixsocket.c (revision 27271) +++ ext/socket/unixsocket.c (revision 27272) @@ -65,7 +65,12 @@ 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) { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/