]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
(_IO_new_file_close_it): Only call _IO_do_flush if stream was last used for
authorUlrich Drepper <drepper@redhat.com>
Wed, 3 Apr 2002 05:20:49 +0000 (05:20 +0000)
committerUlrich Drepper <drepper@redhat.com>
Wed, 3 Apr 2002 05:20:49 +0000 (05:20 +0000)
writing.

libio/fileops.c

index f429a6be90611fe7ffb64a8ea25c5ca7f8de00b7..8a12dae5aebefdf725b73d5d07e42d3cc308bba2 100644 (file)
@@ -159,7 +159,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;
 
   _IO_unsave_markers(fp);