summaryrefslogtreecommitdiff
path: root/thread.c
diff options
context:
space:
mode:
Diffstat (limited to 'thread.c')
-rw-r--r--thread.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/thread.c b/thread.c
index 2f768b2cab..01689ffeb8 100644
--- a/thread.c
+++ b/thread.c
@@ -2018,6 +2018,9 @@ rb_thread_wait_fd_rw(int fd, int read)
int result = 0;
thread_debug("rb_thread_wait_fd_rw(%d, %s)\n", fd, read ? "read" : "write");
+ if (fd < 0) {
+ rb_raise(rb_eIOError, "closed stream");
+ }
while (result <= 0) {
rb_fdset_t set;
rb_fd_init(&set);