From eb7b5f46a3ce11ed41362cfce1675da3932b8e17 Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Mon, 27 Sep 2004 08:24:05 +0000 Subject: Stop on write error. --- usr.sbin/lpr/lptest/lptest.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'usr.sbin') 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 #include +#include /* * 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); -- cgit v1.2.3