changeset 8675:f686a4534abf

Work around glibc's failure to flush stdin on fclose. * lib/closein.c (close_stdin): Flush stdin before closing.
author Eric Blake <ebb9@byu.net>
date Thu, 12 Apr 2007 20:51:24 +0000
parents 72f80d715b09
children 001bd204f631
files ChangeLog lib/closein.c
diffstat 2 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2007-04-12  Eric Blake  <ebb9@byu.net>
 
+	Work around glibc's failure to flush stdin on fclose.
+	* lib/closein.c (close_stdin): Flush stdin before closing.
+
 	Work around glibc's failure to reset seekable stdin on exit.
 	* modules/closein: New module.
 	* lib/closein.c: New file.
--- a/lib/closein.c
+++ b/lib/closein.c
@@ -79,7 +79,7 @@
 close_stdin (void)
 {
   bool fail = false;
-  if (close_stream (stdin) != 0)
+  if (fflush (stdin) != 0 || close_stream (stdin) != 0)
     {
       char const *close_error = _("error closing file");
       if (file_name)