From: Christian Brauner Date: Mon, 15 Feb 2016 18:38:32 +0000 (+0100) Subject: make escape sequence to exit tty optional X-Git-Tag: lxc-2.0.0.rc2~5^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=014d5e1e58778bbdca755fbb7e51b6355983cb4d;p=thirdparty%2Flxc.git make escape sequence to exit tty optional We want to reuse lxc_console_cb_tty_stdin() in lxc_attach.c. Signed-off-by: Christian Brauner --- diff --git a/src/lxc/console.c b/src/lxc/console.c index 67e5d0f17..59981aef6 100644 --- a/src/lxc/console.c +++ b/src/lxc/console.c @@ -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;