From 2f7cde77da873b40290f6bcdf103cee0b2223a8f Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Thu, 20 Dec 2001 10:01:25 +0000 Subject: [PATCH] (close_stdout_status): If ferror (stdout), do not silently exit merely because the output buffer happens to have nothing pending. --- lib/closeout.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/closeout.c b/lib/closeout.c index aee1fcbbaf..0c78b6e4c3 100644 --- a/lib/closeout.c +++ b/lib/closeout.c @@ -94,7 +94,9 @@ close_stdout_status (int status) { int e = ferror (stdout) ? 0 : -1; - if (__fpending (stdout) == 0) + /* If the stream's error bit is clear and there is nothing to flush, + then return right away. */ + if (e && __fpending (stdout) == 0) return; if (fclose (stdout) != 0) -- 2.30.2