diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2017-01-23 04:53:16 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2017-01-23 04:53:16 +0000 |
commit | f989acd01278a89c78176bfde9b8ab9d0e91a569 (patch) | |
tree | ee771a4da76365697bce9de5e37616c4f42b7333 /bin/csh/lex.c | |
parent | eb796682f008c4265a558ccfd7aac7770e5a3691 (diff) |
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.
Diffstat (limited to 'bin/csh/lex.c')
-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; |