mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
8c492668a7
commit
987c03a387
2 changed files with 12 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
|||
Mon Nov 7 19:43:10 2011 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* io.c (rb_close_before_exec): use F_MAXFD if available.
|
||||
F_MAXFD is available on NetBSD since NetBSD 2.0.
|
||||
|
||||
Mon Nov 7 19:25:16 2011 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* test/ruby/test_io_m17n.rb
|
||||
|
|
7
io.c
7
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))))
|
||||
|
|
Loading…
Reference in a new issue