summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--thread_pthread.c12
2 files changed, 13 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 40e7c95c8b..ad904455ec 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Fri May 18 17:39:42 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
+
+ * thread_pthread.c (rb_thread_create_timer_thread): Added error
+ check when failing fcntl(). [Bug #6147] [ruby-dev:45364]
+
Fri May 18 17:41:00 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
* ext/extmk.rb (extmake): link archives only, skip script only
diff --git a/thread_pthread.c b/thread_pthread.c
index 89b05e59da..bfff385292 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -1252,14 +1252,18 @@ rb_thread_create_timer_thread(void)
}
rb_update_max_fd(timer_thread_pipe[0]);
rb_update_max_fd(timer_thread_pipe[1]);
-#if defined(HAVE_FCNTL) && defined(F_GETFL) && defined(F_SETFL)
+#if defined(HAVE_FCNTL) && defined(F_GETFL) && defined(F_SETFL) && defined(O_NONBLOCK)
{
int oflags;
-#if defined(O_NONBLOCK)
+ int err;
+
oflags = fcntl(timer_thread_pipe[1], F_GETFL);
+ if (oflags == -1)
+ rb_sys_fail(0);
oflags |= O_NONBLOCK;
- fcntl(timer_thread_pipe[1], F_SETFL, oflags);
-#endif /* defined(O_NONBLOCK) */
+ err = fcntl(timer_thread_pipe[1], F_SETFL, oflags);
+ if (err == -1)
+ rb_sys_fail(0);
}
#endif /* defined(HAVE_FCNTL) && defined(F_GETFL) && defined(F_SETFL) */