about summary refs log tree commit diff
path: root/libio/wfileops.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-07-25 18:55:52 +0000
committerUlrich Drepper <drepper@redhat.com>2000-07-25 18:55:52 +0000
commita756bab867e70b63d215123451bede9dd01486dd (patch)
tree5482d41191afe1d45dd7d02f0a92f3ce6c759a3a /libio/wfileops.c
parent7f6ba52fc668fb96ced8263ec21957366f1fd2c3 (diff)
downloadglibc-a756bab867e70b63d215123451bede9dd01486dd.tar.gz
glibc-a756bab867e70b63d215123451bede9dd01486dd.tar.xz
glibc-a756bab867e70b63d215123451bede9dd01486dd.zip
(_IO_wfile_underflow): Correct not entirely empty external buffer correctly.
Diffstat (limited to 'libio/wfileops.c')
-rw-r--r--libio/wfileops.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/libio/wfileops.c b/libio/wfileops.c
index 52368abb60..45c9120f34 100644
--- a/libio/wfileops.c
+++ b/libio/wfileops.c
@@ -179,9 +179,6 @@ _IO_wfile_underflow (fp)
     fp->_IO_read_base = fp->_IO_read_ptr = fp->_IO_read_end =
       fp->_IO_buf_base;
 
-  fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_write_end =
-    fp->_IO_buf_base;
-
   if (fp->_IO_buf_base == NULL)
     {
       /* Maybe we already have a push back pointer.  */
@@ -191,8 +188,14 @@ _IO_wfile_underflow (fp)
 	  fp->_flags &= ~_IO_IN_BACKUP;
 	}
       _IO_doallocbuf (fp);
+
+      fp->_IO_read_base = fp->_IO_read_ptr = fp->_IO_read_end =
+	fp->_IO_buf_base;
     }
 
+  fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_write_end =
+    fp->_IO_buf_base;
+
   if (fp->_wide_data->_IO_buf_base == NULL)
     {
       /* Maybe we already have a push back pointer.  */
@@ -211,11 +214,6 @@ _IO_wfile_underflow (fp)
 
   _IO_switch_to_get_mode (fp);
 
-  fp->_IO_read_base = fp->_IO_read_ptr = fp->_IO_buf_base;
-  fp->_IO_read_end = fp->_IO_buf_base;
-  fp->_IO_write_base = fp->_IO_write_ptr = fp->_IO_write_end
-    = fp->_IO_buf_base;
-
   fp->_wide_data->_IO_read_base = fp->_wide_data->_IO_read_ptr =
     fp->_wide_data->_IO_buf_base;
   fp->_wide_data->_IO_read_end = fp->_wide_data->_IO_buf_base;