about summary refs log tree commit diff
path: root/libio/wfileops.c
diff options
context:
space:
mode:
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;