summary refs log tree commit diff
path: root/libio
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-08-04 23:59:30 +0000
committerUlrich Drepper <drepper@redhat.com>2001-08-04 23:59:30 +0000
commit3d759cb8d32614667f58688899fd193926dcf73d (patch)
treeadd45040107d5c7a1eb96c1db9cfb20bcb6e4255 /libio
parentbe1152cab24270b23c4ce6496d164145584c6c11 (diff)
downloadglibc-3d759cb8d32614667f58688899fd193926dcf73d.tar.gz
glibc-3d759cb8d32614667f58688899fd193926dcf73d.tar.xz
glibc-3d759cb8d32614667f58688899fd193926dcf73d.zip
Update.
2001-08-04  Ulrich Drepper  <drepper@redhat.com>

	* libio/fileops.c (_IO_new_file_underflow): Don't call
	_IO_flush_all_linebuffered.  This isn't required in any standard.
	Instead flush only stdout.
	* libio/wfileops.c (_IO_wfile_underflow): Likewise.
Diffstat (limited to 'libio')
-rw-r--r--libio/fileops.c22
-rw-r--r--libio/wfileops.c24
2 files changed, 43 insertions, 3 deletions
diff --git a/libio/fileops.c b/libio/fileops.c
index 3947fa8d6c..f67eeefe6e 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);
 
diff --git a/libio/wfileops.c b/libio/wfileops.c
index 43b6db6133..04a3f5e64f 100644
--- a/libio/wfileops.c
+++ b/libio/wfileops.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993, 95, 97, 98, 99, 2000 Free Software Foundation, Inc.
+/* Copyright (C) 1993,95,97,98,99,2000,2001 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Ulrich Drepper <drepper@cygnus.com>.
    Based on the single byte version by Per Bothner <bothner@cygnus.com>.
@@ -229,7 +229,27 @@ _IO_wfile_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);