aboutsummaryrefslogtreecommitdiff
path: root/lib/libedit/tty.c
diff options
context:
space:
mode:
authorPedro F. Giffuni <pfg@FreeBSD.org>2017-01-30 23:00:51 +0000
committerPedro F. Giffuni <pfg@FreeBSD.org>2017-01-30 23:00:51 +0000
commit678bbc14b25b657d63c91fa9a4bd3068bf100bfa (patch)
tree007f3b832dd6368ef31062783b65fd3f2df7ac05 /lib/libedit/tty.c
parent164aa3ce5e4bada1f189d1c5b56279731aa367ef (diff)
parent70f1d4d70d0c78aa69c52d977130f4046851c4a3 (diff)
Notes
Diffstat (limited to 'lib/libedit/tty.c')
-rw-r--r--lib/libedit/tty.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/libedit/tty.c b/lib/libedit/tty.c
index 7cfa6d1acaf5..971bfc6afd68 100644
--- a/lib/libedit/tty.c
+++ b/lib/libedit/tty.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tty.c,v 1.58 2016/02/27 18:13:21 christos Exp $ */
+/* $NetBSD: tty.c,v 1.59 2016/03/22 01:34:32 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)tty.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: tty.c,v 1.58 2016/02/27 18:13:21 christos Exp $");
+__RCSID("$NetBSD: tty.c,v 1.59 2016/03/22 01:34:32 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
#include <sys/cdefs.h>
@@ -500,10 +500,12 @@ tty_setup(EditLine *el)
{
int rst = 1;
- el->el_tty.t_initialized = 0;
if (el->el_flags & EDIT_DISABLED)
return 0;
+ if (el->el_tty.t_initialized)
+ return -1;
+
if (!isatty(el->el_outfd)) {
#ifdef DEBUG_TTY
(void) fprintf(el->el_errfile, "%s: isatty: %s\n", __func__,
@@ -573,6 +575,7 @@ tty_init(EditLine *el)
el->el_tty.t_mode = EX_IO;
el->el_tty.t_vdisable = _POSIX_VDISABLE;
+ el->el_tty.t_initialized = 0;
(void) memcpy(el->el_tty.t_t, ttyperm, sizeof(ttyperm_t));
(void) memcpy(el->el_tty.t_c, ttychar, sizeof(ttychar_t));
return tty_setup(el);
@@ -589,7 +592,7 @@ tty_end(EditLine *el)
if (el->el_flags & EDIT_DISABLED)
return;
- if (el->el_tty.t_initialized)
+ if (!el->el_tty.t_initialized)
return;
if (tty_setty(el, TCSAFLUSH, &el->el_tty.t_or) == -1) {