summaryrefslogtreecommitdiff
path: root/usr.bin/vi/cl
diff options
context:
space:
mode:
authorMartijn van Duren <martijn@cvs.openbsd.org>2016-05-28 18:30:36 +0000
committerMartijn van Duren <martijn@cvs.openbsd.org>2016-05-28 18:30:36 +0000
commitaa76541e0c7c9ecb87e7ddb1c153c2ee80544611 (patch)
tree5067c63d876f246cfe28e580c86ad23bf506c231 /usr.bin/vi/cl
parent2580ce0cc3163dbe0db840f88f8f8837ac6da8d9 (diff)
Test if stdin is a terminal before resetting the tty state.
Diff supplied by Kai Antweiler. OK semarie@ and deraadt@
Diffstat (limited to 'usr.bin/vi/cl')
-rw-r--r--usr.bin/vi/cl/cl_screen.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/vi/cl/cl_screen.c b/usr.bin/vi/cl/cl_screen.c
index 744b03d7224..6f75e4bc61d 100644
--- a/usr.bin/vi/cl/cl_screen.c
+++ b/usr.bin/vi/cl/cl_screen.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cl_screen.c,v 1.26 2016/02/11 16:34:12 tim Exp $ */
+/* $OpenBSD: cl_screen.c,v 1.27 2016/05/28 18:30:35 martijn Exp $ */
/*-
* Copyright (c) 1993, 1994
@@ -165,7 +165,8 @@ cl_quit(GS *gp)
* implementations get it wrong. It may discard type-ahead characters
* from the tty queue.
*/
- (void)tcsetattr(STDIN_FILENO, TCSADRAIN | TCSASOFT, &clp->orig);
+ if (F_ISSET(clp, CL_STDIN_TTY))
+ (void)tcsetattr(STDIN_FILENO, TCSADRAIN | TCSASOFT, &clp->orig);
F_CLR(clp, CL_SCR_EX_INIT | CL_SCR_VI_INIT);
return (rval);