]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
make escape sequence to exit tty optional
authorChristian Brauner <christian.brauner@mailbox.org>
Mon, 15 Feb 2016 18:38:32 +0000 (19:38 +0100)
committerChristian Brauner <christian.brauner@mailbox.org>
Sun, 21 Feb 2016 16:04:35 +0000 (17:04 +0100)
We want to reuse lxc_console_cb_tty_stdin() in lxc_attach.c.

Signed-off-by: Christian Brauner <christian.brauner@mailbox.org>
src/lxc/console.c

index 67e5d0f177e33ce4b2810b7e3c522b2c30bce6ce..59981aef6921284acb0870debda1f1fc5492b66a 100644 (file)
@@ -641,16 +641,19 @@ static int lxc_console_cb_tty_stdin(int fd, uint32_t events, void *cbdata,
                return 1;
        }
 
-       /* we want to exit the console with Ctrl+a q */
-       if (c == ts->escape && !ts->saw_escape) {
-               ts->saw_escape = 1;
-               return 0;
-       }
+       if (ts->escape != -1) {
+               /* we want to exit the console with Ctrl+a q */
+               if (c == ts->escape && !ts->saw_escape) {
+                       ts->saw_escape = 1;
+                       return 0;
+               }
 
-       if (c == 'q' && ts->saw_escape)
-               return 1;
+               if (c == 'q' && ts->saw_escape)
+                       return 1;
+
+               ts->saw_escape = 0;
+       }
 
-       ts->saw_escape = 0;
        if (write(ts->masterfd, &c, 1) < 0) {
                SYSERROR("failed to write");
                return 1;