about summary refs log tree commit diff
path: root/libio/fileops.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-04-03 05:18:32 +0000
committerUlrich Drepper <drepper@redhat.com>2002-04-03 05:18:32 +0000
commit3384a8d67c2e46701356623fdd0a56f3b0734865 (patch)
tree67e6fbd5212fb840120798e8a861ce4f75907074 /libio/fileops.c
parent7a73a7e685a784b8f7014516a3c968ac74d6d3eb (diff)
downloadglibc-3384a8d67c2e46701356623fdd0a56f3b0734865.tar.gz
glibc-3384a8d67c2e46701356623fdd0a56f3b0734865.tar.xz
glibc-3384a8d67c2e46701356623fdd0a56f3b0734865.zip
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.
Diffstat (limited to 'libio/fileops.c')
-rw-r--r--libio/fileops.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libio/fileops.c b/libio/fileops.c
index 7144a87289..7f833e5094 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);