aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorPoul-Henning Kamp <phk@FreeBSD.org>2004-09-27 08:24:05 +0000
committerPoul-Henning Kamp <phk@FreeBSD.org>2004-09-27 08:24:05 +0000
commiteb7b5f46a3ce11ed41362cfce1675da3932b8e17 (patch)
treea326ef2de8b38bc0a539b12630bdb861546bea79 /usr.sbin
parent2a61444749b956b25aacbbc2e3a07e4d83d59bc0 (diff)
downloadsrc-eb7b5f46a3ce11ed41362cfce1675da3932b8e17.tar.gz
src-eb7b5f46a3ce11ed41362cfce1675da3932b8e17.zip
Stop on write error.
Notes
Notes: svn path=/head/; revision=135852
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/lpr/lptest/lptest.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/usr.sbin/lpr/lptest/lptest.c b/usr.sbin/lpr/lptest/lptest.c
index c73b7962ed89..304296392e92 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);