From 8d9a9aab67d6d517995532737a37379c20dc7f76 Mon Sep 17 00:00:00 2001 From: normal Date: Tue, 20 Nov 2018 07:27:28 +0000 Subject: thread_pthread.c (rb_reserved_fd_p): false-positive on negative FD Negative-numbered FDs are never valid FDs on POSIX-like platforms, and we initialize our self-pipes/eventfd values to "-1", so stop treating -1 as a reserved FD if our system is too low on resources to allocate FDs at startup. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- thread_pthread.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'thread_pthread.c') diff --git a/thread_pthread.c b/thread_pthread.c index 1f2ac00b67..c87e952750 100644 --- a/thread_pthread.c +++ b/thread_pthread.c @@ -1842,6 +1842,10 @@ ruby_stack_overflowed_p(const rb_thread_t *th, const void *addr) int rb_reserved_fd_p(int fd) { + /* no false-positive if out-of-FD at startup */ + if (fd < 0) + return 0; + #if UBF_TIMER == UBF_TIMER_PTHREAD if (fd == timer_pthread.low[0] || fd == timer_pthread.low[1]) goto check_pid; -- cgit v1.2.3