diff options
author | eadler <eadler@FreeBSD.org> | 2012-05-30 04:06:38 +0000 |
---|---|---|
committer | eadler <eadler@FreeBSD.org> | 2012-05-30 04:06:38 +0000 |
commit | cab3b5ae21d231e3adaf1bd7c620c6489537cd8c (patch) | |
tree | 71afe9d037a385cd11b7fda759261608ae2ac4ad /lib/libc/stdio/fpurge.c | |
parent | 9e814fa38b1e176cc004bd131b6e16ad7c82f8b9 (diff) | |
download | FreeBSD-src-cab3b5ae21d231e3adaf1bd7c620c6489537cd8c.zip FreeBSD-src-cab3b5ae21d231e3adaf1bd7c620c6489537cd8c.tar.gz |
Only set _w to 0 when the file stream is not currently reading. Without
this fflush may fail to write data in the buffer.
PR: kern/137819
Submitted by: Eric Blake <ebb9@byu.net>
Reviewed by: theraven
Approved by: cperciva
MFC after: 2 weeks
Diffstat (limited to 'lib/libc/stdio/fpurge.c')
-rw-r--r-- | lib/libc/stdio/fpurge.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/libc/stdio/fpurge.c b/lib/libc/stdio/fpurge.c index 6a2c70c..148e490 100644 --- a/lib/libc/stdio/fpurge.c +++ b/lib/libc/stdio/fpurge.c @@ -62,7 +62,7 @@ fpurge(fp) FREEUB(fp); fp->_p = fp->_bf._base; fp->_r = 0; - fp->_w = fp->_flags & (__SLBF|__SNBF) ? 0 : fp->_bf._size; + fp->_w = fp->_flags & (__SLBF|__SNBF|__SRD) ? 0 : fp->_bf._size; retval = 0; } FUNLOCKFILE(fp); |