diff options
author | Ulrich Drepper <drepper@redhat.com> | 1999-07-26 02:38:26 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 1999-07-26 02:38:26 +0000 |
commit | c7f7281eca160b12767b9e3c25b443bce13512a2 (patch) | |
tree | 7d814d87dcbd5437bcaaa5bc19d94c78d7392ad2 /libio | |
parent | 63f7cb448b3958d7520d7eab6d092d7e6f11f1d9 (diff) | |
download | glibc-c7f7281eca160b12767b9e3c25b443bce13512a2.tar.gz |
Update.
* libio/iofclose.c (_IO_new_fclose): Detect new streams and handle
them appropriately.
* libio/oldiofclose.c (_IO_old_fclose): Likewise.
Diffstat (limited to 'libio')
-rw-r--r-- | libio/iofclose.c | 8 | ||||
-rw-r--r-- | libio/oldiofclose.c | 6 |
2 files changed, 13 insertions, 1 deletions
diff --git a/libio/iofclose.c b/libio/iofclose.c index 61f7800ed8..b9cb0a9980 100644 --- a/libio/iofclose.c +++ b/libio/iofclose.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993, 1995, 1997, 1998 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1995, 1997, 1998, 1999 Free Software Foundation, Inc. This file is part of the GNU IO Library. This library is free software; you can redistribute it and/or @@ -36,6 +36,12 @@ _IO_new_fclose (fp) CHECK_FILE(fp, EOF); + /* We desperately try to help programs which are using streams in a + strange way and mix old and new functions. Detect old streams + here. */ + if (fp->_vtable_offset != 0) + return _IO_old_fclose (fp); + _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); _IO_flockfile (fp); if (fp->_IO_file_flags & _IO_IS_FILEBUF) diff --git a/libio/oldiofclose.c b/libio/oldiofclose.c index 51781366d6..8ddad32b04 100644 --- a/libio/oldiofclose.c +++ b/libio/oldiofclose.c @@ -37,6 +37,12 @@ _IO_old_fclose (fp) CHECK_FILE(fp, EOF); + /* We desperately try to help programs which are using streams in a + strange way and mix old and new functions. Detect new streams + here. */ + if (fp->_vtable_offset == 0) + return _IO_new_fclose (fp); + _IO_cleanup_region_start ((void (*) __P ((void *))) _IO_funlockfile, fp); _IO_flockfile (fp); if (fp->_IO_file_flags & _IO_IS_FILEBUF) |