From d73a00981c48bb84ec3ed678ab2cae52a13d34f8 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 6 Nov 2004 22:37:02 +0000 Subject: [PATCH] (xfclose): Don't close stdout here (just flush it), since close_stdout now closes stdout unconditionally. --- src/sort.c | 6 ++++++ 1 file changed, 6 insertions(+) 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) -- 2.34.1