From d090f8233714ef7a0447ed1194b82ab097d42c99 Mon Sep 17 00:00:00 2001 From: deraadt Date: Mon, 12 Dec 2005 20:10:53 +0000 Subject: in the write codepaths, errors other than EAGAIN are fatal to the loop; ok otto --- usr.bin/script/script.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'usr.bin/script/script.c') diff --git a/usr.bin/script/script.c b/usr.bin/script/script.c index df99958634f..885c3a48d54 100644 --- a/usr.bin/script/script.c +++ b/usr.bin/script/script.c @@ -1,4 +1,4 @@ -/* $OpenBSD: script.c,v 1.23 2005/04/11 19:59:07 deraadt Exp $ */ +/* $OpenBSD: script.c,v 1.24 2005/12/12 20:10:53 deraadt Exp $ */ /* $NetBSD: script.c,v 1.3 1994/12/21 08:55:43 jtc Exp $ */ /* @@ -65,7 +65,7 @@ static const char copyright[] = #if 0 static const char sccsid[] = "@(#)script.c 8.1 (Berkeley) 6/6/93"; #endif -static const char rcsid[] = "$OpenBSD: script.c,v 1.23 2005/04/11 19:59:07 deraadt Exp $"; +static const char rcsid[] = "$OpenBSD: script.c,v 1.24 2005/12/12 20:10:53 deraadt Exp $"; #endif /* not lint */ #include @@ -188,6 +188,8 @@ main(int argc, char *argv[]) break; for (off = 0; off < cc; ) { ssize_t n = write(master, ibuf + off, cc - off); + if (n == -1 && errno != EAGAIN) + break; if (n == 0) break; /* skip writing */ if (n > 0) @@ -273,6 +275,8 @@ dooutput(void) sigprocmask(SIG_BLOCK, &blkalrm, NULL); for (off = 0; off < cc; ) { ssize_t n = write(STDOUT_FILENO, obuf + off, cc - off); + if (n == -1 && errno != EAGAIN) + break; if (n == 0) break; /* skip writing */ if (n > 0) -- cgit v1.2.3-59-g8ed1b