diff options
Diffstat (limited to 'newlib/libc/stdio/fflush.c')
-rw-r--r-- | newlib/libc/stdio/fflush.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/newlib/libc/stdio/fflush.c b/newlib/libc/stdio/fflush.c index 05084dde0..0b157d0ce 100644 --- a/newlib/libc/stdio/fflush.c +++ b/newlib/libc/stdio/fflush.c @@ -67,23 +67,13 @@ _DEFUN(fflush, (fp), if (fp == NULL) return _fwalk (_GLOBAL_REENT, fflush); - CHECK_INIT (_REENT); - _flockfile (fp); + CHECK_INIT (fp); + t = fp->_flags; - if ((t & __SWR) == 0) - { - /* For a read stream, an fflush causes the next seek to be - unoptimized (i.e. forces a system-level seek). This conforms - to the POSIX and SUSv3 standards. */ - fp->_flags |= __SNPT; - _funlockfile (fp); - return 0; - } - if ((p = fp->_bf._base) == NULL) + if ((t & __SWR) == 0 || (p = fp->_bf._base) == NULL) { - /* Nothing to flush. */ _funlockfile (fp); return 0; } |