summaryrefslogtreecommitdiff
path: root/usr.bin/tip/tip.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2003-10-15 22:33:19 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2003-10-15 22:33:19 +0000
commit8a2a20a82d9ab9fcdb5f1ae4281b8425baee5185 (patch)
treed608dd1b72db3a14fb0683ff7a1ed626b97d4d3b /usr.bin/tip/tip.c
parent77ac78a622f37da316607f99d6333ac32d3bdad6 (diff)
on fatal error, repair tty; millert ok
Diffstat (limited to 'usr.bin/tip/tip.c')
-rw-r--r--usr.bin/tip/tip.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/tip/tip.c b/usr.bin/tip/tip.c
index b7b16439479..3e862851d7e 100644
--- a/usr.bin/tip/tip.c
+++ b/usr.bin/tip/tip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tip.c,v 1.21 2003/09/20 18:15:32 millert Exp $ */
+/* $OpenBSD: tip.c,v 1.22 2003/10/15 22:33:18 deraadt Exp $ */
/* $NetBSD: tip.c,v 1.13 1997/04/20 00:03:05 mellon Exp $ */
/*
@@ -40,7 +40,7 @@ static const char copyright[] =
#if 0
static char sccsid[] = "@(#)tip.c 8.1 (Berkeley) 6/6/93";
#endif
-static const char rcsid[] = "$OpenBSD: tip.c,v 1.21 2003/09/20 18:15:32 millert Exp $";
+static const char rcsid[] = "$OpenBSD: tip.c,v 1.22 2003/10/15 22:33:18 deraadt Exp $";
#endif /* not lint */
/*
@@ -212,6 +212,7 @@ cucommon:
}
tcgetattr(0, &defterm);
+ gotdefterm = 1;
term = defterm;
term.c_lflag &= ~(ICANON|IEXTEN|ECHO);
term.c_iflag &= ~(INPCK|ICRNL);
@@ -251,6 +252,7 @@ cleanup()
(void)uu_unlock(uucplock);
if (odisc)
ioctl(0, TIOCSETD, (char *)&odisc);
+ unraw();
exit(0);
}
@@ -306,7 +308,8 @@ raw()
void
unraw()
{
- tcsetattr(0, TCSADRAIN, &defterm);
+ if (gotdefterm)
+ tcsetattr(0, TCSADRAIN, &defterm);
}
static jmp_buf promptbuf;