diff options
author | Tim J. Robbins <tjr@FreeBSD.org> | 2002-11-08 02:51:31 +0000 |
---|---|---|
committer | Tim J. Robbins <tjr@FreeBSD.org> | 2002-11-08 02:51:31 +0000 |
commit | 7b0267069da8621f94476a556e629c016ef449dd (patch) | |
tree | a0d338c8e4736baa9b96564b6eb8c1d9f29d878b /usr.bin/yes | |
parent | b3925aab0995422acc159d5d13969faf02d8c148 (diff) | |
download | src-test-7b0267069da8621f94476a556e629c016ef449dd.tar.gz src-test-7b0267069da8621f94476a556e629c016ef449dd.zip |
Detect and exit on write errors.
Notes
Notes:
svn path=/head/; revision=106608
Diffstat (limited to 'usr.bin/yes')
-rw-r--r-- | usr.bin/yes/yes.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/usr.bin/yes/yes.c b/usr.bin/yes/yes.c index 0eb060ddebb3c..73716e23cd997 100644 --- a/usr.bin/yes/yes.c +++ b/usr.bin/yes/yes.c @@ -51,8 +51,11 @@ int main(int argc, char **argv) { if (argc > 1) - for(;;) - puts(argv[1]); - else for (;;) - puts("y"); + while (puts(argv[1]) != EOF) + ; + else + while (puts("y") != EOF) + ; + err(1, "stdout"); + /*NOTREACHED*/ } |