diff options
author | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-05-18 08:47:54 +0000 |
---|---|---|
committer | kosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-05-18 08:47:54 +0000 |
commit | 1a2ef6bae3c0db71adbbe9e871ca87a87b4d647c (patch) | |
tree | 52a7084c106f2f487742ccdab2f382ed9ee76b82 /thread_pthread.c | |
parent | c7c7dfd2fcbb7305d28cdff5d1ac44f4ad9c4fe3 (diff) |
* thread_pthread.c (rb_thread_create_timer_thread): Added error
check when failing fcntl(). [Bug #6147] [ruby-dev:45364]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_pthread.c')
-rw-r--r-- | thread_pthread.c | 12 |
1 files changed, 8 insertions, 4 deletions
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) */ |