[Spice-commits] src/spicy.c

Marc-André Lureau elmarco at kemper.freedesktop.org
Fri Oct 7 11:51:48 UTC 2016


 src/spicy.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

New commits:
commit 89b531ac451f83c8c446d60304f0394a11a481b3
Author: Marc-André Lureau <marcandre.lureau at redhat.com>
Date:   Fri Oct 7 15:26:49 2016 +0400

    spicy: fix reset of terminal when quit
    
    Only restore the terminal if it was actually saved.
    
    Signed-off-by: Marc-André Lureau <marcandre.lureau at redhat.com>
    Acked-by: Victor Toso <victortoso at redhat.com>

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);
     }
 


More information about the Spice-commits mailing list