From 951b0901302d851bac96341f181c8f0a1ece54d1 Mon Sep 17 00:00:00 2001 From: kosaki Date: Wed, 4 May 2011 03:47:33 +0000 Subject: [PATCH] * thread.c (rb_wait_for_single_fd): Added POLLNVAL check. based on a patch from Eric Wong at [ruby-core:35991]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ thread.c | 5 ++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index a8120d2af5..104a4677bb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Wed May 4 12:46:25 2011 KOSAKI Motohiro + + * thread.c (rb_wait_for_single_fd): Added POLLNVAL check. + based on a patch from Eric Wong at [ruby-core:35991]. + Wed May 4 11:51:01 2011 KOSAKI Motohiro * io.c (rb_f_select): remove useless ifdef. diff --git a/thread.c b/thread.c index 6246243706..5e10a8366f 100644 --- a/thread.c +++ b/thread.c @@ -2737,7 +2737,10 @@ retry: }, ubf_select, GET_THREAD()); if (result > 0) { - /* remain compatible with select(2)-based implementation */ + if (fds.revents & POLLNVAL) { + errno = EBADF; + return -1; + } result = (int)(fds.revents & fds.events); return result == 0 ? events : result; }