summaryrefslogtreecommitdiff
path: root/io.c
diff options
context:
space:
mode:
Diffstat (limited to 'io.c')
-rw-r--r--io.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/io.c b/io.c
index da93d45253..cb10187e2b 100644
--- a/io.c
+++ b/io.c
@@ -290,11 +290,11 @@ io_write(io, str)
break;
n = ptr - RSTRING(str)->ptr;
}
- if (n == 0 && ferror(f))
+ if (n != RSTRING(str)->len && ferror(f))
rb_sys_fail(fptr->path);
#else
n = fwrite(RSTRING(str)->ptr, 1, RSTRING(str)->len, f);
- if (n == 0 && ferror(f)) {
+ if (n != RSTRING(str)->len && ferror(f)) {
rb_sys_fail(fptr->path);
}
#endif