diff options
author | phk <phk@FreeBSD.org> | 2004-09-27 08:24:05 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2004-09-27 08:24:05 +0000 |
commit | c96236a596468f9a094ba362e92f94e534b1c926 (patch) | |
tree | a326ef2de8b38bc0a539b12630bdb861546bea79 /usr.sbin/lpr/lptest | |
parent | fc66d174a383a0c0a0c8f0e7efe382835938cf7a (diff) | |
download | FreeBSD-src-c96236a596468f9a094ba362e92f94e534b1c926.zip FreeBSD-src-c96236a596468f9a094ba362e92f94e534b1c926.tar.gz |
Stop on write error.
Diffstat (limited to 'usr.sbin/lpr/lptest')
-rw-r--r-- | usr.sbin/lpr/lptest/lptest.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.sbin/lpr/lptest/lptest.c b/usr.sbin/lpr/lptest/lptest.c index c73b796..3042963 100644 --- a/usr.sbin/lpr/lptest/lptest.c +++ b/usr.sbin/lpr/lptest/lptest.c @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include <stdlib.h> #include <stdio.h> +#include <err.h> /* * lptest -- line printer test program (and other devices). @@ -75,11 +76,13 @@ main(int argc, char **argv) fc = ' '; nc = fc; for (j = 0; j < len; j++) { - putchar(nc); + if (putchar(nc) == EOF) + err(1, "Write error"); if (++nc == 0177) nc = ' '; } - putchar('\n'); + if (putchar('\n') == EOF) + err(1, "Write error"); } (void) fflush(stdout); exit(0); |