summaryrefslogtreecommitdiffstats
path: root/usr.sbin/lpr/lptest
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>2004-09-27 08:24:05 +0000
committerphk <phk@FreeBSD.org>2004-09-27 08:24:05 +0000
commitc96236a596468f9a094ba362e92f94e534b1c926 (patch)
treea326ef2de8b38bc0a539b12630bdb861546bea79 /usr.sbin/lpr/lptest
parentfc66d174a383a0c0a0c8f0e7efe382835938cf7a (diff)
downloadFreeBSD-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.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 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);
OpenPOWER on IntegriCloud