# HG changeset patch # User Eric Blake # Date 1176411084 0 # Node ID f686a4534abf8e29659ad3992fe286ecd7d326e8 # Parent 72f80d715b09deb875f3229614e42326b20c9bc9 Work around glibc's failure to flush stdin on fclose. * lib/closein.c (close_stdin): Flush stdin before closing. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ 2007-04-12 Eric Blake + 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. diff --git a/lib/closein.c b/lib/closein.c --- 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)