From b03bdcd64f8c010717f014dd58025655bf7b6c51 Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 21 Jan 2002 07:44:06 +0000 Subject: * eval.c (ruby_stop): should not trace error handler. * signal.c (install_sighandler): do not install sighandler unless the old value is SIG_DFL. * 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/trunk@2009 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- io.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'io.c') diff --git a/io.c b/io.c index 54438b4f87..c5fb2359f6 100644 --- a/io.c +++ b/io.c @@ -255,14 +255,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 -- cgit v1.2.3