diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-04-17 06:24:48 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2000-04-17 06:24:48 +0000 |
commit | cf520dda16af27d2ce41b5b082bf4e5035815cb0 (patch) | |
tree | b1e49888c083cf2f93a6c7a72f5ad36448b52b98 /io.c | |
parent | 57c75615b9934230e317fd6b84296d514e919a1f (diff) |
2000-04-17
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_4@669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'io.c')
-rw-r--r-- | io.c | 20 |
1 files changed, 12 insertions, 8 deletions
@@ -211,7 +211,7 @@ io_write(io, str) } #endif if (fptr->mode & FMODE_SYNC) { - fflush(f); + if (fflush(f) == EOF) rb_sys_fail(fptr->path); } return INT2FIX(n); @@ -243,7 +243,7 @@ rb_io_flush(io) rb_io_check_writable(fptr); f = GetWriteFile(fptr); - if (fflush(f) == EOF) rb_sys_fail(0); + if (fflush(f) == EOF) rb_sys_fail(fptr->path); return io; } @@ -958,6 +958,9 @@ rb_io_close(io) OpenFile *fptr; fptr = RFILE(io)->fptr; + if (fptr->mode & FMODE_WRITABLE) { + rb_io_flush(io); + } rb_io_fptr_close(fptr); if (fptr->pid) { rb_syswait(fptr->pid); @@ -1698,10 +1701,10 @@ rb_io_reopen(io, nfile) if (fptr == orig) return io; if (orig->f2) { - fflush(orig->f2); + if (fflush(orig->f2) == EOF) rb_sys_fail(orig->path); } else if (orig->mode & FMODE_WRITABLE) { - fflush(orig->f); + if (fflush(orig->f) == EOF) rb_sys_fail(orig->path); } rb_thread_fd_close(fileno(fptr->f)); @@ -1814,10 +1817,10 @@ rb_io_clone(io) MakeOpenFile(obj, fptr); if (orig->f2) { - fflush(orig->f2); + if (fflush(orig->f2) == EOF) rb_sys_fail(orig->path); } else if (orig->mode & FMODE_WRITABLE) { - fflush(orig->f); + if (fflush(orig->f) == EOF) rb_sys_fail(orig->path); } /* copy OpenFile structure */ @@ -1941,8 +1944,9 @@ rb_io_putc(io, ch) if (fputc(c, f) == EOF) rb_sys_fail(fptr->path); - if (fptr->mode & FMODE_SYNC) - fflush(f); + if (fptr->mode & FMODE_SYNC) { + if (fflush(f) == EOF) rb_sys_fail(fptr->path); + } return ch; } |