diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-10-29 12:28:32 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-10-29 12:28:32 +0000 |
commit | 49aadcd76b9ab48c4cebbf542379d7b0f2d6a117 (patch) | |
tree | 2679c44dffa58646b6675f9cc5ef707751a7a472 /io.c | |
parent | 53e8bf24715b21048e6156f1b05d9f288a170db0 (diff) | |
download | ruby-49aadcd76b9ab48c4cebbf542379d7b0f2d6a117.tar.gz ruby-49aadcd76b9ab48c4cebbf542379d7b0f2d6a117.tar.xz ruby-49aadcd76b9ab48c4cebbf542379d7b0f2d6a117.zip |
* io.c (rb_io_check_initialized): new function to check uninitialized
object. [ruby-talk:118234]
* file.c (rb_file_path), io.c (rb_io_closed): check if initialized.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@7140 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -182,12 +182,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) ptr += c; if ((n -= c) <= 0) break; } - rb_thread_wait_fd(fileno(f)); + rb_thread_wait_fd(fileno(f)); TRAP_BEG; c = getc(f); TRAP_END; @@ -2028,6 +2035,7 @@ rb_io_closed(io) OpenFile *fptr; fptr = RFILE(io)->fptr; + rb_io_check_initialized(fptr); return (fptr->f || fptr->f2)?Qfalse:Qtrue; } |