[lxc-devel] [lxc/master] If the console client exited, clean the tty_state and return 0

lifeng68 on Github lxc-bot at linuxcontainers.org
Tue Sep 5 08:02:56 UTC 2017


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 1194 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170905/2186e137/attachment.bin>
-------------- next part --------------
From 8e5b5b6b4cd0f5cb1350d8a8787bdfe4809e342b Mon Sep 17 00:00:00 2001
From: LiFeng <lifeng68 at huawei.com>
Date: Tue, 5 Sep 2017 23:16:50 +0800
Subject: [PATCH] If the console client exited, clean the tty_state and return
 0

Signed-off-by: LiFeng <lifeng68 at huawei.com>
---
 src/lxc/console.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/lxc/console.c b/src/lxc/console.c
index 666754d27..bd13402cc 100644
--- a/src/lxc/console.c
+++ b/src/lxc/console.c
@@ -174,8 +174,15 @@ static int lxc_console_cb_con(int fd, uint32_t events, void *data,
 	if (r <= 0) {
 		INFO("console client on fd %d has exited", fd);
 		lxc_mainloop_del_handler(descr, fd);
+		if (fd == console->peer) {
+			if (console->tty_state) {
+				lxc_console_sigwinch_fini(console->tty_state);
+				console->tty_state = NULL;
+			}
+			console->peer = -1;
+		}
 		close(fd);
-		return 1;
+		return 0;
 	}
 
 	if (fd == console->peer)


More information about the lxc-devel mailing list