summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/sort.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/sort.c b/src/sort.c
index 511d0994d..f607385b7 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -480,6 +480,12 @@ xfclose (FILE *fp, char const *file)
if (feof (fp))
clearerr (fp);
}
+ else if (fp == stdout)
+ {
+ /* Don't close stdout just yet. close_stdout does that. */
+ if (fflush (fp) != 0)
+ die (_("fflush failed"), file);
+ }
else
{
if (fclose (fp) != 0)