From: anton Date: Fri, 3 Nov 2023 19:32:28 +0000 (+0000) Subject: Check if a signal already has been received before entering a blocking X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=acbb6deec378b6fc0d456a9e25f1628759f51779;p=openbsd Check if a signal already has been received before entering a blocking read as opposed of only doing it afterwards. Issue uncovered by the mail regress tests. With claudio@ and ok millert@ --- diff --git a/usr.bin/mail/tty.c b/usr.bin/mail/tty.c index 51f7ab7797b..0cc2bae7c0e 100644 --- a/usr.bin/mail/tty.c +++ b/usr.bin/mail/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.23 2023/03/08 04:43:11 guenther Exp $ */ +/* $OpenBSD: tty.c,v 1.24 2023/11/03 19:32:28 anton Exp $ */ /* $NetBSD: tty.c,v 1.7 1997/07/09 05:25:46 mikel Exp $ */ /* @@ -324,7 +324,10 @@ tty_getc(struct tty *t) ssize_t n; unsigned char c; - n = read(t->fdin, &c, 1); + if (ttysignal != 0) + n = -1; + else + n = read(t->fdin, &c, 1); switch (n) { case -1: t->flags |= TTY_ERR;