summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-11-07 10:44:02 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-11-07 10:44:02 +0000
commit987c03a387fd0cb9cc4880bfffee51e5d18209e8 (patch)
tree4880ad9f434993dd5889a37696f36e5ede80e86a /io.c
parent8c492668a7b31820918fe4f9768ee56d891bd96e (diff)
* io.c (rb_close_before_exec): use F_MAXFD if available.
F_MAXFD is available on NetBSD since NetBSD 2.0. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/io.c b/io.c
index 8dabdbcc9a..307611f7a2 100644
--- a/io.c
+++ b/io.c
@@ -5123,6 +5123,13 @@ rb_close_before_exec(int lowfd, int maxhint, VALUE noclose_fds)
int max = max_file_descriptor;
if (max < maxhint)
max = maxhint;
+#ifdef F_MAXFD
+ /* F_MAXFD is available since NetBSD 2.0. */
+ ret = fcntl(0, F_MAXFD);
+ if (ret != -1) {
+ max = ret;
+ }
+#endif
for (fd = lowfd; fd <= max; fd++) {
if (!NIL_P(noclose_fds) &&
RTEST(rb_hash_lookup(noclose_fds, INT2FIX(fd))))