Commit 89b531ac authored by Marc-André Lureau's avatar Marc-André Lureau

spicy: fix reset of terminal when quit

Only restore the terminal if it was actually saved.
Signed-off-by: default avatarMarc-André Lureau <marcandre.lureau@redhat.com>
Acked-by: Victor Toso's avatarVictor Toso <victortoso@redhat.com>
parent 364d5bbe
......@@ -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);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment