summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-01-21 07:43:41 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-01-21 07:43:41 +0000
commit4c2c8f099c305476c0361937c12f59fd5bfbc788 (patch)
treeaa9e156cbc680ee49ba0fa1bf9bd15d41676e7c9 /io.c
parent551de15b61b773c3460e6b574df4ef4f7dc09807 (diff)
* eval.c (ruby_stop): should not trace error handler.
* io.c (io_write): should not raise exception on O_NONBLOCK io. * dir.c (dir_set_pos): seek should return dir, pos= should not. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_6@2008 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r--io.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/io.c b/io.c
index d5fcbeb2c9..d2abd6544f 100644
--- a/io.c
+++ b/io.c
@@ -247,14 +247,14 @@ io_write(io, str)
n = (int)RSTRING(str)->len;
while (--n >= 0)
if (fputc(*ptr++, f) == EOF)
- rb_sys_fail(fptr->path);
+ break;
n = ptr - RSTRING(str)->ptr;
}
- if (ferror(f))
+ if (n == 0 && ferror(f))
rb_sys_fail(fptr->path);
#else
n = fwrite(RSTRING(str)->ptr, 1, RSTRING(str)->len, f);
- if (ferror(f)) {
+ if (n == 0 && ferror(f)) {
rb_sys_fail(fptr->path);
}
#endif
@@ -920,7 +920,7 @@ rb_io_each_byte(io)
rb_yield(INT2FIX(c & 0xff));
}
if (ferror(f)) rb_sys_fail(fptr->path);
- return Qnil;
+ return io;
}
VALUE
@@ -1084,6 +1084,7 @@ rb_io_close_m(io)
if (rb_safe_level() >= 4 && !OBJ_TAINTED(io)) {
rb_raise(rb_eSecurityError, "Insecure: can't close");
}
+ rb_io_check_closed(RFILE(io)->fptr);
rb_io_close(io);
return Qnil;
}