From 268a6dcd9143db2b1dfe6bbf3ba5f87193ad7f39 Mon Sep 17 00:00:00 2001 From: akr Date: Mon, 5 Jan 2009 15:35:21 +0000 Subject: * io.c (rb_close_before_exec): more heuristics to detect maximum fd. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21347 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ io.c | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 857547760..adabbd6bc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Tue Jan 6 00:34:25 2009 Tanaka Akira + + * io.c (rb_close_before_exec): more heuristics to detect maximum fd. + Mon Jan 5 17:59:43 2009 Nobuyoshi Nakada * configure.in (cygwin): needs properly implemented nl_langinfo(). diff --git a/io.c b/io.c index ffb407375..46136d7ee 100644 --- a/io.c +++ b/io.c @@ -4452,8 +4452,13 @@ rb_close_before_exec(int lowfd, int maxhint, VALUE noclose_fds) fcntl(fd, F_SETFD, ret|FD_CLOEXEC); } #else - close(fd); + ret = close(fd); #endif +#define CONTIGUOUS_CLOSED_FDS 20 + if (ret != -1) { + if (max < fd + CONTIGUOUS_CLOSED_FDS) + max = fd + CONTIGUOUS_CLOSED_FDS; + } } } -- cgit