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
This commit is contained in:
Eitan Adler 2012-05-30 04:06:38 +00:00
parent af57f4cf56
commit e5d9109aab
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=236288

View File

@ -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);