diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2006-12-14 22:47:12 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2006-12-14 22:47:12 +0000 |
commit | 4c0b8a072bc2877282383f799274361858ff1c3e (patch) | |
tree | 09a22f55da3a75d23c9fadb25e2df8243e477cd2 /newlib/libc/stdio/fclose.c | |
parent | 6a20095878bec4a4d262b0d027a10f269248d527 (diff) | |
download | cygnal-4c0b8a072bc2877282383f799274361858ff1c3e.tar.gz cygnal-4c0b8a072bc2877282383f799274361858ff1c3e.tar.bz2 cygnal-4c0b8a072bc2877282383f799274361858ff1c3e.zip |
2006-12-14 Jeff Johnston <jjohnstn@redhat.com>
Eric Blake <ebb9@byu.net>
* libc/stdio/fflush.c (fflush): On seekable streams, always flush
read but unused data.
* libc/stdio/fclose.c (_fclose_r): Always flush streams, since
even read streams may have side effects that must happen.
Diffstat (limited to 'newlib/libc/stdio/fclose.c')
-rw-r--r-- | newlib/libc/stdio/fclose.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/newlib/libc/stdio/fclose.c b/newlib/libc/stdio/fclose.c index bb3acb624..08df75fb4 100644 --- a/newlib/libc/stdio/fclose.c +++ b/newlib/libc/stdio/fclose.c @@ -86,7 +86,10 @@ _DEFUN(_fclose_r, (rptr, fp), __sfp_lock_release (); return (0); } - r = fp->_flags & __SWR ? fflush (fp) : 0; + /* Unconditionally flush to allow special handling for seekable read + files to reposition file to last byte processed as opposed to + last byte read ahead into the buffer. */ + r = fflush (fp); if (fp->_close != NULL && (*fp->_close) (fp->_cookie) < 0) r = EOF; if (fp->_flags & __SMBF) |