[lxc-devel] [lxc/master] console: report detach message on demand

brauner on Github lxc-bot at linuxcontainers.org
Fri Nov 10 18:53:32 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 516 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20171110/61cd20e7/attachment.bin>
-------------- next part --------------
From 686df166906b62317cd82fdc94db7a6e29fee423 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Fri, 10 Nov 2017 19:51:57 +0100
Subject: [PATCH] console: report detach message on demand

When users pass -1 there's there won't be an escape sequence to exit the
console so no need to print a misleading info message about how to detach.

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 src/lxc/console.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/lxc/console.c b/src/lxc/console.c
index 934e1d132..216165720 100644
--- a/src/lxc/console.c
+++ b/src/lxc/console.c
@@ -832,11 +832,14 @@ int lxc_console(struct lxc_container *c, int ttynum,
 		goto close_mainloop;
 	}
 
-	fprintf(stderr, "\n"
+	if (ts->escape >= 1) {
+		fprintf(stderr,
+			"\n"
 			"Connected to tty %1$d\n"
 			"Type <Ctrl+%2$c q> to exit the console, "
 			"<Ctrl+%2$c Ctrl+%2$c> to enter Ctrl+%2$c itself\n",
 			ttynum, 'a' + escape - 1);
+	}
 
 	if (istty) {
 		ret = lxc_setup_tios(stdinfd, &oldtios);


More information about the lxc-devel mailing list