From: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx> Only restore the terminal if it was actually saved. Signed-off-by: Marc-André Lureau <marcandre.lureau@xxxxxxxxxx> --- src/spicy.c | 10 +++++++--- 1 file 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); } -- 2.10.0 _______________________________________________ Spice-devel mailing list Spice-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.freedesktop.org/mailman/listinfo/spice-devel