summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/io.c b/io.c
index 5d66bdf4b0..6bab4f9378 100644
--- a/io.c
+++ b/io.c
@@ -189,6 +189,9 @@ rb_update_max_fd(int fd)
struct stat buf;
rb_atomic_t afd = (rb_atomic_t)fd;
+ if (afd <= max_file_descriptor)
+ return;
+
if (fstat(fd, &buf) != 0 && errno == EBADF) {
rb_bug("rb_update_max_fd: invalid fd (%d) given.", fd);
}