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
This commit is contained in:
normal 2017-05-07 07:38:30 +00:00
Родитель a0da514102
Коммит b1bb2520c8
1 изменённых файлов: 9 добавлений и 3 удалений

12
io.c
Просмотреть файл

@ -9480,11 +9480,17 @@ do_fcntl(int fd, int cmd, long narg)
arg.narg = narg; arg.narg = narg;
retval = (int)rb_thread_io_blocking_region(nogvl_fcntl, &arg, fd); retval = (int)rb_thread_io_blocking_region(nogvl_fcntl, &arg, fd);
if (retval != -1) {
switch (cmd) {
#if defined(F_DUPFD) #if defined(F_DUPFD)
if (retval != -1 && cmd == F_DUPFD) { case F_DUPFD:
rb_update_max_fd(retval);
}
#endif #endif
#if defined(F_DUPFD_CLOEXEC)
case F_DUPFD_CLOEXEC:
#endif
rb_update_max_fd(retval);
}
}
return retval; return retval;
} }