summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-22 00:52:54 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-22 00:52:54 +0000
commit27ca36712d26c88e092a1bacdffa2d5cd1646975 (patch)
tree9f7823c8e749516850cbdae669194efc164a8d36 /ext
parent9e11c028e3ff12da9e44f1ece7d100b84834e183 (diff)
merge revision(s) 45084: [Backport #9547]
* ext/socket/init.c (wait_connectable): break if the socket is writable to avoid infinite loops on FreeBSD and other platforms which conforms to SUSv3. This problem cannot be reproduced with loopback interfaces, so it's hard to write test code. rsock_connect() and wait_connectable() are overly complicated, so they should be refactored, but I commit this fix as a workaround for the release of Ruby 1.9.3 scheduled on Feb 24. [ruby-core:60940] [Bug #9547] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_3@45092 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext')
-rw-r--r--ext/socket/init.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/ext/socket/init.c b/ext/socket/init.c
index 54452e4b99..e63fb80c74 100644
--- a/ext/socket/init.c
+++ b/ext/socket/init.c
@@ -281,8 +281,12 @@ wait_connectable(int fd)
*/
if (ret < 0)
break;
- if (sockerr == 0)
- continue; /* workaround for winsock */
+ if (sockerr == 0) {
+ if (revents & RB_WAITFD_OUT)
+ break;
+ else
+ continue; /* workaround for winsock */
+ }
/* BSD and Linux use sockerr. */
errno = sockerr;