ruby-changes:23645
From: kosaki <ko1@a...>
Date: Fri, 18 May 2012 17:48:02 +0900 (JST)
Subject: [ruby-changes:23645] kosaki:r35696 (trunk): * thread_pthread.c (rb_thread_create_timer_thread): Added error
kosaki 2012-05-18 17:47:54 +0900 (Fri, 18 May 2012) New Revision: 35696 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=35696 Log: * thread_pthread.c (rb_thread_create_timer_thread): Added error check when failing fcntl(). [Bug #6147] [ruby-dev:45364] Modified files: trunk/ChangeLog trunk/thread_pthread.c Index: ChangeLog =================================================================== --- ChangeLog (revision 35695) +++ ChangeLog (revision 35696) @@ -1,3 +1,8 @@ +Fri May 18 17:39:42 2012 KOSAKI Motohiro <kosaki.motohiro@g...> + + * 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@r...> * ext/extmk.rb (extmake): link archives only, skip script only Index: thread_pthread.c =================================================================== --- thread_pthread.c (revision 35695) +++ thread_pthread.c (revision 35696) @@ -1252,14 +1252,18 @@ } 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) */ -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/