summaryrefslogtreecommitdiff
path: root/lib/closeout.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2001-12-20 10:01:25 +0000
committerJim Meyering <jim@meyering.net>2001-12-20 10:01:25 +0000
commit8d83abaf8938587604a656932bcd7e290293d879 (patch)
tree2a3616dfdb70e13c482e10ba06b0e39eb0f281d7 /lib/closeout.c
parent82a83f37433712247685430d476894da77d83a93 (diff)
downloadcoreutils-8d83abaf8938587604a656932bcd7e290293d879.tar.xz
(close_stdout_status): If ferror (stdout), do
not silently exit merely because the output buffer happens to have nothing pending.
Diffstat (limited to 'lib/closeout.c')
-rw-r--r--lib/closeout.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/closeout.c b/lib/closeout.c
index aee1fcbba..0c78b6e4c 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)