* lib/closein.c (close_stdin): Flush stdin before closing.
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.
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)