summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-05 15:35:21 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-01-05 15:35:21 +0000
commite6045986ef2c491a7842c1a5d34b683303c11ef0 (patch)
treed0946322fa7be92fb933c652b44faf2cd56aaf14 /io.c
parent0cd078e358fda09865d2a5b2d4c0c24eeb629811 (diff)
* io.c (rb_close_before_exec): more heuristics to detect maximum fd.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21347 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/io.c b/io.c
index ffb4073750..46136d7ee7 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;
+ }
}
}