summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authoreadler <eadler@FreeBSD.org>2012-05-30 04:06:38 +0000
committereadler <eadler@FreeBSD.org>2012-05-30 04:06:38 +0000
commitcab3b5ae21d231e3adaf1bd7c620c6489537cd8c (patch)
tree71afe9d037a385cd11b7fda759261608ae2ac4ad /lib
parent9e814fa38b1e176cc004bd131b6e16ad7c82f8b9 (diff)
downloadFreeBSD-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')
-rw-r--r--lib/libc/stdio/fpurge.c2
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);
OpenPOWER on IntegriCloud