diff options
author | Marc-André Lureau <marcandre.lureau@redhat.com> | 2016-10-07 15:26:49 +0400 |
---|---|---|
committer | Marc-André Lureau <marcandre.lureau@redhat.com> | 2016-10-07 15:50:58 +0400 |
commit | 89b531ac451f83c8c446d60304f0394a11a481b3 (patch) | |
tree | 5661538592035c6f2e4ac015a268be46aa88c1c8 | |
parent | 364d5bbe16d8a82281f413505b620ae31912f0cc (diff) |
spicy: fix reset of terminal when quitv0.33
Only restore the terminal if it was actually saved.
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Victor Toso <victortoso@redhat.com>
-rw-r--r-- | src/spicy.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/spicy.c b/src/spicy.c index 92de251..c502428 100644 --- a/src/spicy.c +++ b/src/spicy.c @@ -1818,14 +1818,18 @@ static void setup_terminal(gboolean reset) return; #ifdef HAVE_TERMIOS_H - static struct termios saved_tios; struct termios tios; + static struct termios saved_tios; + static bool saved = false; - if (reset) + if (reset) { + if (!saved) + return; tios = saved_tios; - else { + } else { tcgetattr(stdinfd, &tios); saved_tios = tios; + saved = true; tios.c_lflag &= ~(ICANON | ECHO); } |