mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* io.c (rb_update_max_fd): Return immediately if the given fd is small
enough. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44641 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
f962eba5f4
commit
e457f6312f
2 changed files with 8 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Sat Jan 18 22:35:15 2014 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* io.c (rb_update_max_fd): Return immediately if the given fd is small
|
||||||
|
enough.
|
||||||
|
|
||||||
Sat Jan 18 22:25:53 2014 Tanaka Akira <akr@fsij.org>
|
Sat Jan 18 22:25:53 2014 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
* io.c: Test O_CLOEXEC only once.
|
* io.c: Test O_CLOEXEC only once.
|
||||||
|
|
3
io.c
3
io.c
|
@ -189,6 +189,9 @@ rb_update_max_fd(int fd)
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
rb_atomic_t afd = (rb_atomic_t)fd;
|
rb_atomic_t afd = (rb_atomic_t)fd;
|
||||||
|
|
||||||
|
if (afd <= max_file_descriptor)
|
||||||
|
return;
|
||||||
|
|
||||||
if (fstat(fd, &buf) != 0 && errno == EBADF) {
|
if (fstat(fd, &buf) != 0 && errno == EBADF) {
|
||||||
rb_bug("rb_update_max_fd: invalid fd (%d) given.", fd);
|
rb_bug("rb_update_max_fd: invalid fd (%d) given.", fd);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue