aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authornormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-07 07:38:30 +0000
committernormal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-05-07 07:38:30 +0000
commit5cb9cead557b6db07899771c6fab4cdb203f2cf0 (patch)
treeeca578a8449c072d80e8f3b36c6854dd06efb229 /io.c
parentdd24f1294849877ba0a6f6751d46b8af88f31919 (diff)
downloadruby-5cb9cead557b6db07899771c6fab4cdb203f2cf0.tar.gz
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.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/io.c b/io.c
index 9f6c2fe871..c274c9b9fe 100644
--- a/io.c
+++ b/io.c
@@ -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;
}