summary refs log tree commit diff
path: root/libio
diff options
context:
space:
mode:
Diffstat (limited to 'libio')
-rw-r--r--libio/genops.c7
-rw-r--r--libio/wgenops.c2
2 files changed, 9 insertions, 0 deletions
diff --git a/libio/genops.c b/libio/genops.c
index bffc355fa5..89a3dfc152 100644
--- a/libio/genops.c
+++ b/libio/genops.c
@@ -194,6 +194,9 @@ __overflow (f, ch)
      _IO_FILE *f;
      int ch;
 {
+  /* This is a single-byte stream.  */
+  if (f->_mode == 0)
+    _IO_fwide (f, -1);
   return _IO_OVERFLOW (f, ch);
 }
 
@@ -285,6 +288,8 @@ __underflow (fp)
   if (fp->_vtable_offset == 0 && _IO_fwide (fp, -1) != -1)
     return EOF;
 
+  if (fp->_mode == 0)
+    _IO_fwide (fp, -1);
   if (_IO_in_put_mode (fp))
     if (_IO_switch_to_get_mode (fp) == EOF)
       return EOF;
@@ -313,6 +318,8 @@ __uflow (fp)
   if (fp->_vtable_offset == 0 && _IO_fwide (fp, -1) != -1)
     return EOF;
 
+  if (fp->_mode == 0)
+    _IO_fwide (fp, -11);
   if (_IO_in_put_mode (fp))
     if (_IO_switch_to_get_mode (fp) == EOF)
       return EOF;
diff --git a/libio/wgenops.c b/libio/wgenops.c
index f822c8d987..242f3a0077 100644
--- a/libio/wgenops.c
+++ b/libio/wgenops.c
@@ -272,6 +272,8 @@ __wunderflow (fp)
   if (fp->_mode < 0 || (fp->_mode == 0 && _IO_fwide (fp, 1) != 1))
     return WEOF;
 
+  if (fp->_mode == 0)
+    _IO_fwide (fp, 1);
   if (_IO_in_put_mode (fp))
     if (_IO_switch_to_wget_mode (fp) == EOF)
       return WEOF;