From 3384a8d67c2e46701356623fdd0a56f3b0734865 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Wed, 3 Apr 2002 05:18:32 +0000 Subject: Update. * libio/bug-ungetwc1.c: New file. * libio/Makefile (tests): Add bug-ungetwc1. * libio/fileops.c (_IO_new_file_close_it): Only call _IO_do_flush if stream was last used for writing. --- libio/fileops.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'libio/fileops.c') diff --git a/libio/fileops.c b/libio/fileops.c index 7144a87..7f833e5 100644 --- a/libio/fileops.c +++ b/libio/fileops.c @@ -161,7 +161,11 @@ _IO_new_file_close_it (fp) if (!_IO_file_is_open (fp)) return EOF; - write_status = _IO_do_flush (fp); + if ((fp->_flags & _IO_NO_WRITES) == 0 + && (fp->_flags & _IO_CURRENTLY_PUTTING) != 0) + write_status = _IO_do_flush (fp); + else + write_status = 0; INTUSE(_IO_unsave_markers) (fp); -- cgit v1.1