aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-09-09 01:22:06 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-09-09 01:22:06 +0000
commit61b062ba6dac3d7583096bf25158d187413c2029 (patch)
tree377f2b852182dcce39a9b42b84214034e99deb8c
parentfa5446f14e0c57037432911745944da11f570945 (diff)
downloadruby-61b062ba6dac3d7583096bf25158d187413c2029.tar.gz
* thread.c (rb_thread_select): fix a typo to initialize efds
properly. [Bug #5299] [ruby-core:39380] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33231 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--test/-ext-/old_thread_select/test_old_thread_select.rb15
-rw-r--r--thread.c2
3 files changed, 19 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 8bf1d6eefa..ce07350878 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri Sep 9 10:22:03 2011 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * thread.c (rb_thread_select): fix a typo to initialize efds
+ properly. [Bug #5299] [ruby-core:39380]
+
Fri Sep 9 02:02:09 2011 Ayumu AIZAWA <ayumu.aizawa@gmail.com>
* template/yarvarch.ja:
diff --git a/test/-ext-/old_thread_select/test_old_thread_select.rb b/test/-ext-/old_thread_select/test_old_thread_select.rb
index c9b55c81ee..b40f3a429b 100644
--- a/test/-ext-/old_thread_select/test_old_thread_select.rb
+++ b/test/-ext-/old_thread_select/test_old_thread_select.rb
@@ -23,6 +23,17 @@ class TestOldThreadSelect < Test::Unit::TestCase
end
end
+ def test_old_select_error_timeout
+ bug5299 = '[ruby-core:39380]'
+ with_pipe do |r, w|
+ t0 = Time.now
+ rc = IO.old_thread_select(nil, nil, [r.fileno], 0.001)
+ diff = Time.now - t0
+ assert_equal 0, rc, bug5299
+ assert_operator diff, :>=, 0.001, "returned too early"
+ end
+ end
+
def test_old_select_read_write_check
with_pipe do |r, w|
w.syswrite('.')
@@ -63,7 +74,7 @@ class TestOldThreadSelect < Test::Unit::TestCase
assert_equal 0, rc
assert_equal true, thr.value
assert_not_equal false, received, "SIGINT not received"
- ensure
- trap(:INT, "DEFAULT")
+ ensure
+ trap(:INT, "DEFAULT")
end
end
diff --git a/thread.c b/thread.c
index 16e890656b..0466381f73 100644
--- a/thread.c
+++ b/thread.c
@@ -2704,7 +2704,7 @@ rb_thread_select(int max, fd_set * read, fd_set * write, fd_set * except,
}
if (except) {
efds = &fdsets[2];
- rb_fd_init(wfds);
+ rb_fd_init(efds);
rb_fd_copy(efds, except, max);
}