aboutsummaryrefslogtreecommitdiffstats
path: root/thread_pthread.c
diff options
context:
space:
mode:
authorngoto <ngoto@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-15 14:26:22 +0000
committerngoto <ngoto@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-15 14:26:22 +0000
commitd367f7df0e753bc6ba4f4623cc77da5bf7ecd1fd (patch)
tree815ae3e106a6a6741fc7dfdb93215a05d9c0f875 /thread_pthread.c
parent533d985e59f2afd70d51a39356c3f2abc910cdc4 (diff)
downloadruby-d367f7df0e753bc6ba4f4623cc77da5bf7ecd1fd.tar.gz
* process.c (redirect_close, parent_redirect_close): should not close
reserved FD. It should be closed in the exec system call due to the O_CLOEXEC or FD_CLOEXEC flag. [Bug #11353] [ruby-core:69977] * process.c (close_unless_reserved): new function to close FD unless it is reserved for internal communication. * thread_pthread.c (rb_reserved_fd_p): should check owner_process pid to avoid false positive in forked child process. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'thread_pthread.c')
-rw-r--r--thread_pthread.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/thread_pthread.c b/thread_pthread.c
index 84228c8c53..71edee18b0 100644
--- a/thread_pthread.c
+++ b/thread_pthread.c
@@ -1692,10 +1692,11 @@ int
rb_reserved_fd_p(int fd)
{
#if USE_SLEEPY_TIMER_THREAD
- if (fd == timer_thread_pipe.normal[0] ||
- fd == timer_thread_pipe.normal[1] ||
- fd == timer_thread_pipe.low[0] ||
- fd == timer_thread_pipe.low[1]) {
+ if ((fd == timer_thread_pipe.normal[0] ||
+ fd == timer_thread_pipe.normal[1] ||
+ fd == timer_thread_pipe.low[0] ||
+ fd == timer_thread_pipe.low[1]) &&
+ timer_thread_pipe.owner_process == getpid()) { /* async-signal-safe */
return 1;
}
else {