diff options
author | 2017-01-23 04:53:15 +0000 | |
---|---|---|
committer | 2017-01-23 04:53:15 +0000 | |
commit | 2ad5b187d15cce478284c4dcdc0aec1a3d4912af (patch) | |
tree | 6b82ca494cd1c6359cdbf635eefa6e3a4486f437 | |
parent | Keep socket open from startup, and reuse for SIOCGIFFLAGS later on, (diff) | |
download | wireguard-openbsd-2ad5b187d15cce478284c4dcdc0aec1a3d4912af.tar.xz wireguard-openbsd-2ad5b187d15cce478284c4dcdc0aec1a3d4912af.zip |
Call isatty() before tcgetattr() in the lex. This is a little redundant,
but avoids doing pledge "tty" operations against flat files. The shell's
tty will be kind of special in the near future. isatty is also a lot less
kernel code to run through the loop.
-rw-r--r-- | bin/csh/lex.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/bin/csh/lex.c b/bin/csh/lex.c index 4ad9b01853e..6d3d731159b 100644 --- a/bin/csh/lex.c +++ b/bin/csh/lex.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lex.c,v 1.23 2016/04/16 18:32:29 krw Exp $ */ +/* $OpenBSD: lex.c,v 1.24 2017/01/23 04:53:15 deraadt Exp $ */ /* $NetBSD: lex.c,v 1.9 1995/09/27 00:38:46 jtc Exp $ */ /*- @@ -1337,7 +1337,7 @@ reread: if (wanteof) return (-1); /* was isatty but raw with ignoreeof yields problems */ - if (tcgetattr(SHIN, &tty) == 0 && (tty.c_lflag & ICANON)) + if (isatty(SHIN) && tcgetattr(SHIN, &tty) == 0 && (tty.c_lflag & ICANON)) { pid_t ctpgrp; |