From 88a56a14d9b092c7e88c05f8a18c8e3fb8844ca1 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Thu, 12 Apr 2007 20:51:24 +0000 Subject: [PATCH] Work around glibc's failure to flush stdin on fclose. * lib/closein.c (close_stdin): Flush stdin before closing. --- ChangeLog | 3 +++ lib/closein.c | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 9cb7ecb3d..d78b5f4f5 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 1aade1d18..515348426 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) -- 2.11.0