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 1996-08-13 17:49:45 +00:00
parent 3582282621
commit 8864908b30

View File

@ -39,7 +39,7 @@
static char sccsid[] = "@(#)refill.c 8.1 (Berkeley) 6/4/93"; static char sccsid[] = "@(#)refill.c 8.1 (Berkeley) 6/4/93";
#endif #endif
static const char rcsid[] = 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 */ #endif /* LIBC_SCCS and not lint */
#include <errno.h> #include <errno.h>
@ -54,7 +54,7 @@ lflush(fp)
FILE *fp; FILE *fp;
{ {
if ((fp->_flags & (__SLBF|__SWR)) == __SLBF|__SWR) if ((fp->_flags & (__SLBF|__SWR)) == (__SLBF|__SWR))
return (__sflush(fp)); return (__sflush(fp));
return (0); return (0);
} }