diff options
author | tjr <tjr@FreeBSD.org> | 2002-11-08 02:51:31 +0000 |
---|---|---|
committer | tjr <tjr@FreeBSD.org> | 2002-11-08 02:51:31 +0000 |
commit | dff8f5c919bf65f72d98cd9eb58cd308101f1fa0 (patch) | |
tree | a0d338c8e4736baa9b96564b6eb8c1d9f29d878b /usr.bin/yes | |
parent | 9ca980d0e75354085693a9a0343428e783095374 (diff) | |
download | FreeBSD-src-dff8f5c919bf65f72d98cd9eb58cd308101f1fa0.zip FreeBSD-src-dff8f5c919bf65f72d98cd9eb58cd308101f1fa0.tar.gz |
Detect and exit on write errors.
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 0eb060d..73716e2 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*/ } |