summary refs log tree commit diff
path: root/libio
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2003-08-25 22:02:03 +0000
committerUlrich Drepper <drepper@redhat.com>2003-08-25 22:02:03 +0000
commit41c26b683e8f7d2eaec65d96cb9c7eba663dcd81 (patch)
treee099d818f638a8709f37b5fdea53b31a948e5eae /libio
parent82d8607da1e320ca964438b8158abb93a9b3d356 (diff)
downloadglibc-41c26b683e8f7d2eaec65d96cb9c7eba663dcd81.tar.gz
glibc-41c26b683e8f7d2eaec65d96cb9c7eba663dcd81.tar.xz
glibc-41c26b683e8f7d2eaec65d96cb9c7eba663dcd81.zip
Update.
2003-08-25  Ulrich Drepper  <drepper@redhat.com>

	* libio/oldfileops.c (_IO_old_file_init): Initialize _mode field
	if the object size is large enough.
Diffstat (limited to 'libio')
-rw-r--r--libio/oldfileops.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/libio/oldfileops.c b/libio/oldfileops.c
index 2efbadb44e..81e41503b2 100644
--- a/libio/oldfileops.c
+++ b/libio/oldfileops.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1993,95,97,98,99,2000,2002 Free Software Foundation, Inc.
+/* Copyright (C) 1993,95,97,98,99,2000,2002,2003 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
    Written by Per Bothner <bothner@cygnus.com>.
 
@@ -128,6 +128,15 @@ _IO_old_file_init (fp)
   fp->file._vtable_offset = ((int) sizeof (struct _IO_FILE)
 			     - (int) sizeof (struct _IO_FILE_complete));
   fp->file._fileno = -1;
+
+#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))
+    /* The object is dynamically allocated and large enough.  Initialize
+       the _mode element as well.  */
+    fp->_mode = -1;
+#endif
 }
 
 int