summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-22 04:17:51 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-02-22 04:17:51 +0000
commit977b723312738e1b0243a7ac567a61df1de4040f (patch)
treeb0dc32ba120955f5e2aaf2961d63add4d6f90007
parent0e048fde890f4c9fcc093586a48317dfcaf93e2e (diff)
downloadruby-977b723312738e1b0243a7ac567a61df1de4040f.tar.gz
merge revision(s) r45084: [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_2_0_0@45103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog11
-rw-r--r--ext/socket/init.c8
-rw-r--r--version.h2
3 files changed, 18 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index ce4fa34e0c..26ea3f4b08 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+Sat Feb 22 13:04:54 2014 Shugo Maeda <shugo@ruby-lang.org>
+
+ * 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]
+
Sat Feb 22 12:55:24 2014 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org>
(merged partially from r42927)
diff --git a/ext/socket/init.c b/ext/socket/init.c
index 9999c02969..53f946044a 100644
--- a/ext/socket/init.c
+++ b/ext/socket/init.c
@@ -314,8 +314,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;
diff --git a/version.h b/version.h
index 9f3c7e47a1..3d3b99275e 100644
--- a/version.h
+++ b/version.h
@@ -1,6 +1,6 @@
#define RUBY_VERSION "2.0.0"
#define RUBY_RELEASE_DATE "2014-02-22"
-#define RUBY_PATCHLEVEL 446
+#define RUBY_PATCHLEVEL 447
#define RUBY_RELEASE_YEAR 2014
#define RUBY_RELEASE_MONTH 2