summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2017-01-23 04:53:15 +0000
committerderaadt <deraadt@openbsd.org>2017-01-23 04:53:15 +0000
commit2ad5b187d15cce478284c4dcdc0aec1a3d4912af (patch)
tree6b82ca494cd1c6359cdbf635eefa6e3a4486f437
parentKeep socket open from startup, and reuse for SIOCGIFFLAGS later on, (diff)
downloadwireguard-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.c4
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;