Fix nasty bracketing/precedence bug. Every time something read (and

refilled) a file that was either line- or un-buffered, all files were
flushed.  According to the code comment, the flush (according to ANSI)
is supposed to happen on write + line buffered output files, not _all_
files.

Obtained from: OpenBSD / Theo de Raadt, possibly from proven@cygnus.com
This commit is contained in:
Peter Wemm 1996-08-13 17:49:45 +00:00
parent c2bfae006a
commit 1ec21d5930
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=17584

View File

@ -39,7 +39,7 @@
static char sccsid[] = "@(#)refill.c 8.1 (Berkeley) 6/4/93";
#endif
static const char rcsid[] =
"$Id$";
"$Id: refill.c,v 1.3 1996/06/22 10:33:45 jraynard Exp $";
#endif /* LIBC_SCCS and not lint */
#include <errno.h>
@ -54,7 +54,7 @@ lflush(fp)
FILE *fp;
{
if ((fp->_flags & (__SLBF|__SWR)) == __SLBF|__SWR)
if ((fp->_flags & (__SLBF|__SWR)) == (__SLBF|__SWR))
return (__sflush(fp));
return (0);
}