Work around glibc's failure to flush stdin on fclose.
authorEric Blake <ebb9@byu.net>
Thu, 12 Apr 2007 20:51:24 +0000 (20:51 +0000)
committerEric Blake <ebb9@byu.net>
Thu, 12 Apr 2007 20:51:24 +0000 (20:51 +0000)
* lib/closein.c (close_stdin): Flush stdin before closing.

ChangeLog
lib/closein.c

index 9cb7ecb3dfe32f6f2e64791e55b85961d9e8c717..d78b5f4f51808a93759590c26a29ce39bc81bd21 100644 (file)
--- 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.
index 1aade1d18f69f0bcdef00d82dabbdfaad85a52aa..51534842624451e877783ea56d2974ac55a1b0cb 100644 (file)
@@ -79,7 +79,7 @@ void
 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)