From 21efb309e7bd3985647d806b1ef7969c16afba02 Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 17 Nov 2000 04:41:19 +0000 Subject: matz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- io.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'io.c') diff --git a/io.c b/io.c index 6470788fce..42234bfb6b 100644 --- a/io.c +++ b/io.c @@ -208,8 +208,13 @@ io_fflush(f, path) FILE *f; const char *path; { + int n; + rb_thread_fd_writable(fileno(f)); - if (fflush(f) == EOF) rb_sys_fail(path); + TRAP_BEG; + n = fflush(f); + TRAP_END; + if (n == EOF) rb_sys_fail(path); } /* writing functions */ @@ -1050,9 +1055,6 @@ 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); -- cgit v1.2.3