diff --git a/io.c b/io.c index 2731bb829f..1074689560 100644 --- a/io.c +++ b/io.c @@ -1775,6 +1775,7 @@ io_fillbuf(rb_io_t *fptr) rb_syserr_fail_path(e, path); } } + if (r > 0) rb_io_check_closed(fptr); fptr->rbuf.off = 0; fptr->rbuf.len = (int)r; /* r should be <= rbuf_capa */ if (r == 0)