aboutsummaryrefslogtreecommitdiff
path: root/libio/fileops.c
diff options
context:
space:
mode:
Diffstat (limited to 'libio/fileops.c')
-rw-r--r--libio/fileops.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/libio/fileops.c b/libio/fileops.c
index 3947fa8..f67eeef 100644
--- a/libio/fileops.c
+++ b/libio/fileops.c
@@ -506,7 +506,27 @@ _IO_new_file_underflow (fp)
/* Flush all line buffered files before reading. */
/* FIXME This can/should be moved to genops ?? */
if (fp->_flags & (_IO_LINE_BUF|_IO_UNBUFFERED))
- _IO_flush_all_linebuffered ();
+ {
+#if 0
+ _IO_flush_all_linebuffered ();
+#else
+ /* We used to flush all line-buffered stream. This really isn't
+ required by any standard. My recollection is that
+ traditional Unix systems did this for stdout. stderr better
+ not be line buffered. So we do just that here
+ explicitly. --drepper */
+ _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile,
+ _IO_stdout);
+ _IO_flockfile (_IO_stdout);
+
+ if ((_IO_stdout->_flags & (_IO_LINKED | _IO_NO_WRITES | _IO_LINE_BUF))
+ == (_IO_LINKED | _IO_LINE_BUF))
+ _IO_OVERFLOW (_IO_stdout, EOF);
+
+ _IO_funlockfile (_IO_stdout);
+ _IO_cleanup_region_end (0);
+#endif
+ }
_IO_switch_to_get_mode (fp);