summaryrefslogtreecommitdiff
path: root/src/yes.c
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2016-04-04 13:17:34 +0100
committerPádraig Brady <P@draigBrady.com>2016-04-21 21:34:00 +0100
commit0f5d784bc6c8f63be70cffeaaa88aaca740c3bf6 (patch)
tree00970cc61ea104fdb908a45628693ee79ce4f7b2 /src/yes.c
parent2ef621251992bc0b9fbc9ada98606996047ed8a3 (diff)
downloadcoreutils-0f5d784bc6c8f63be70cffeaaa88aaca740c3bf6.tar.xz
yes: avoid redundant diagnostics on write error
* src/yes.c (main): For large inputs only write a single diagnostic for write errors. * tests/misc/yes.sh: Test when /dev/full is available.
Diffstat (limited to 'src/yes.c')
-rw-r--r--src/yes.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/yes.c b/src/yes.c
index 31424cf20..1d2c612c9 100644
--- a/src/yes.c
+++ b/src/yes.c
@@ -121,6 +121,7 @@ main (int argc, char **argv)
if ((pbuf - buf) && fwrite (buf, pbuf - buf, 1, stdout) != 1)
{
error (0, errno, _("standard output"));
+ clearerr (stdout);
return EXIT_FAILURE;
}
for (j = i; j < argc; j++)
@@ -128,6 +129,7 @@ main (int argc, char **argv)
|| putchar (j == argc - 1 ? '\n' : ' ') == EOF)
{
error (0, errno, _("standard output"));
+ clearerr (stdout);
return EXIT_FAILURE;
}
}