summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/io.c b/io.c
index 87cd6a8b5e..2de3de7f44 100644
--- a/io.c
+++ b/io.c
@@ -183,12 +183,19 @@ rb_io_taint_check(io)
}
void
-rb_io_check_closed(fptr)
+rb_io_check_initialized(fptr)
OpenFile *fptr;
{
if (!fptr) {
rb_raise(rb_eIOError, "uninitialized stream");
}
+}
+
+void
+rb_io_check_closed(fptr)
+ OpenFile *fptr;
+{
+ rb_io_check_initialized(fptr);
if (!fptr->f && !fptr->f2) {
rb_raise(rb_eIOError, "closed stream");
}
@@ -941,7 +948,7 @@ rb_io_fread(ptr, len, f)
if (len > n) {
clearerr(f);
}
- rb_thread_wait_fd(fileno(f));
+ rb_thread_wait_fd(fileno(f));
}
if (len == n) return 0;
}
@@ -1889,6 +1896,7 @@ rb_io_closed(io)
OpenFile *fptr;
fptr = RFILE(io)->fptr;
+ rb_io_check_initialized(fptr);
return (fptr->f || fptr->f2)?Qfalse:Qtrue;
}