diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-05-07 07:38:30 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-05-07 07:38:30 +0000 |
commit | b1bb2520c80186cf18d44574cf1b204d1560f02f (patch) | |
tree | eca578a8449c072d80e8f3b36c6854dd06efb229 /io.c | |
parent | a0da514102d0b642e43a22b38f832289caa375b5 (diff) |
io.c (do_fcntl): update max FD for F_DUPFD_CLOEXEC, too
Somebody may pass 1030 (the value of F_DUPFD_CLOEXEC) to IO#fcntl
because they copied code from somewhere else. Ensure we know
about FDs created that way.
* io.c (do_fcntl): update max FD for F_DUPFD_CLOEXEC, too
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -9480,11 +9480,17 @@ do_fcntl(int fd, int cmd, long narg) arg.narg = narg; retval = (int)rb_thread_io_blocking_region(nogvl_fcntl, &arg, fd); + if (retval != -1) { + switch (cmd) { #if defined(F_DUPFD) - if (retval != -1 && cmd == F_DUPFD) { - rb_update_max_fd(retval); - } + case F_DUPFD: +#endif +#if defined(F_DUPFD_CLOEXEC) + case F_DUPFD_CLOEXEC: #endif + rb_update_max_fd(retval); + } + } return retval; } |