From: Eric Blake Date: Thu, 12 Apr 2007 20:51:24 +0000 (+0000) Subject: Work around glibc's failure to flush stdin on fclose. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=88a56a14d9b092c7e88c05f8a18c8e3fb8844ca1;p=pspp 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 index 9cb7ecb3df..d78b5f4f51 100644 --- 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 index 1aade1d18f..5153484262 100644 --- a/lib/closein.c +++ b/lib/closein.c @@ -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)