From cab3b5ae21d231e3adaf1bd7c620c6489537cd8c Mon Sep 17 00:00:00 2001 From: eadler Date: Wed, 30 May 2012 04:06:38 +0000 Subject: 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 Reviewed by: theraven Approved by: cperciva MFC after: 2 weeks --- lib/libc/stdio/fpurge.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/libc') 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); -- cgit v1.1