summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/io.c b/io.c
index b8d2e5b..a174263 100644
--- a/io.c
+++ b/io.c
@@ -154,6 +154,10 @@ static int max_file_descriptor = NOFILE;
void
rb_update_max_fd(int fd)
{
+ struct stat buf;
+ if (fstat(fd, &buf) != 0) {
+ rb_bug("rb_update_max_fd: invalid fd (%d) given.", fd);
+ }
if (max_file_descriptor < fd) max_file_descriptor = fd;
}