about summary refs log tree commit diff
path: root/libio/iofwide.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-09-06 03:37:22 +0000
committerUlrich Drepper <drepper@redhat.com>2000-09-06 03:37:22 +0000
commitb853e8fa2ef3dafe300b386426012509a50d6175 (patch)
treee6a33bfb0c7b3da236b674a3f981e5e3cf61bfa8 /libio/iofwide.c
parent10878c33f13e20b77fe8b49f9185e2d9a03be45a (diff)
downloadglibc-b853e8fa2ef3dafe300b386426012509a50d6175.tar.gz
glibc-b853e8fa2ef3dafe300b386426012509a50d6175.tar.xz
glibc-b853e8fa2ef3dafe300b386426012509a50d6175.zip
(_IO_fwide): If compatibility with glibc 2.0 is needed tst for such an old structure and don't do anything.
Diffstat (limited to 'libio/iofwide.c')
-rw-r--r--libio/iofwide.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/libio/iofwide.c b/libio/iofwide.c
index 231cc56c34..2e2854aa62 100644
--- a/libio/iofwide.c
+++ b/libio/iofwide.c
@@ -36,6 +36,7 @@
 # include <locale/localeinfo.h>
 # include <wcsmbs/wcsmbsload.h>
 # include <iconv/gconv_int.h>
+# include <shlib-compat.h>
 #endif
 
 
@@ -96,9 +97,20 @@ _IO_fwide (fp, mode)
   /* Normalize the value.  */
   mode = mode < 0 ? -1 : (mode == 0 ? 0 : 1);
 
-  if (mode == 0 || fp->_mode != 0)
-    /* The caller simply wants to know about the current orientation
-       or the orientation already has been determined.  */
+  if (mode == 0)
+    /* The caller simply wants to know about the current orientation.  */
+    return fp->_mode;
+
+#if defined SHARED && defined _LIBC \
+    && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_1)
+  if (__builtin_expect (&_IO_stdin_used == NULL, 0)
+      && (fp == _IO_stdin ||  fp == _IO_stdout || fp == _IO_stderr))
+    /* This is for a stream in the glibc 2.0 format.  */
+    return -1;
+#endif
+
+  if (fp->_mode != 0)
+    /* The orientation already has been determined.  */
     return fp->_mode;
 
   /* Set the orientation appropriately.  */