svn commit: r236288 - head/lib/libc/stdio

Eitan Adler eadler at FreeBSD.org
Wed May 30 04:06:40 UTC 2012


Author: eadler
Date: Wed May 30 04:06:38 2012
New Revision: 236288
URL: http://svn.freebsd.org/changeset/base/236288

Log:
  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 at byu.net>
  Reviewed by:	theraven
  Approved by:	cperciva
  MFC after:	2 weeks

Modified:
  head/lib/libc/stdio/fpurge.c

Modified: head/lib/libc/stdio/fpurge.c
==============================================================================
--- head/lib/libc/stdio/fpurge.c	Wed May 30 03:57:49 2012	(r236287)
+++ head/lib/libc/stdio/fpurge.c	Wed May 30 04:06:38 2012	(r236288)
@@ -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);


More information about the svn-src-head mailing list