From beafb7521f1ce231fa3ac799cdedd361b3469886 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 24 Jul 2001 04:22:05 +0000 Subject: Update. * libio/iofclose.c (_IO_new_fclose): Unlink descriptor first to avoid deadlock. * libio/oldiofclose.c (_IO_old_fclose): Likewise. * libio/genops.c (_IO_un_link): Get stream lock since it's not always done in the caller. (_IO_link_in): Likewise. --- libio/oldiofclose.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'libio/oldiofclose.c') diff --git a/libio/oldiofclose.c b/libio/oldiofclose.c index 0c6066175b..c42e2f4eac 100644 --- a/libio/oldiofclose.c +++ b/libio/oldiofclose.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1993,1995,1997,1998,1999,2000 Free Software Foundation, Inc. +/* Copyright (C) 1993, 1995, 1997-2000, 2001 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -48,6 +48,10 @@ _IO_old_fclose (fp) if (fp->_vtable_offset == 0) return _IO_new_fclose (fp); + /* First unlink the stream. */ + if (fp->_IO_file_flags & _IO_IS_FILEBUF) + _IO_un_link ((struct _IO_FILE_plus *) fp); + _IO_cleanup_region_start ((void (*) (void *)) _IO_funlockfile, fp); _IO_flockfile (fp); if (fp->_IO_file_flags & _IO_IS_FILEBUF) -- cgit v1.2.3