aboutsummaryrefslogtreecommitdiffstats
path: root/io.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-11-29 06:09:40 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2004-11-29 06:09:40 +0000
commit83cb605d69f20be5fe842a913e51d017f61cdc44 (patch)
treeb227250a931f8465854064c4860265d76a1974c9 /io.c
parent6e221605373ff89fd52d08d5df86cfb0bd805de7 (diff)
downloadruby-83cb605d69f20be5fe842a913e51d017f61cdc44.tar.gz
* object.c (convert_type): [ruby-core:03845]
* eval.c (rb_funcall_rescue): new function. * object.c (rb_Array): avoid using rb_respond_to(). * object.c (rb_Integer): ditto. * eval.c (get_backtrace): no conversion for nil. * parse.y (reduce_nodes): empty body should return nil. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@7413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/io.c b/io.c
index 0cd715798c..b9b2c78f3c 100644
--- a/io.c
+++ b/io.c
@@ -334,6 +334,7 @@ io_fflush(f, fptr)
if (n != EOF) break;
if (!rb_io_wait_writable(fileno(f)))
rb_sys_fail(fptr->path);
+ rb_io_check_closed(fptr);
}
fptr->mode &= ~FMODE_WBUF;
}
@@ -1027,6 +1028,7 @@ rb_io_fread(ptr, len, f)
of.f = f;
of.f2 = NULL;
+ of.mode = FMODE_READABLE;
return io_fread(ptr, len, &of);
}
@@ -4030,6 +4032,9 @@ rb_io_initialize(argc, argv, io)
fp->mode = rb_io_modenum_flags(flags);
fp->f = rb_fdopen(fd, rb_io_modenum_mode(flags));
}
+ else if (RFILE(io)->fptr) {
+ rb_raise(rb_eRuntimeError, "reinitializing IO");
+ }
else {
GetOpenFile(orig, ofp);
if (ofp->refcnt == LONG_MAX) {
@@ -4047,11 +4052,6 @@ rb_io_initialize(argc, argv, io)
}
}
}
- if (RFILE(io)->fptr) {
- rb_io_close(io);
- free(RFILE(io)->fptr);
- RFILE(io)->fptr = 0;
- }
ofp->refcnt++;
RFILE(io)->fptr = ofp;
}