lxc/0099-terminal-do-not-close-the-master-fd-of-pty.patch

29 lines
943 B
Diff
Raw Normal View History

From bb22a4c3d79d2ad60e00e77cdea7bc782414cf56 Mon Sep 17 00:00:00 2001
2019-09-30 11:03:07 -04:00
From: LiFeng <lifeng68@huawei.com>
Date: Tue, 21 May 2019 04:53:16 -0400
Subject: [PATCH 099/138] terminal: do not close the master fd of pty
2019-09-30 11:03:07 -04:00
Signed-off-by: LiFeng <lifeng68@huawei.com>
---
src/lxc/terminal.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/lxc/terminal.c b/src/lxc/terminal.c
index dfce92e..88653b4 100644
2019-09-30 11:03:07 -04:00
--- a/src/lxc/terminal.c
+++ b/src/lxc/terminal.c
@@ -595,6 +595,10 @@ int lxc_terminal_io_cb(int fd, uint32_t events, void *data,
if (w_log < 0)
TRACE("Failed to write %d bytes to terminal log", r);
}
+ /* notes: do not close the master fd due to if we close the fd, the process may
+ * recive SIGHUP and the exit code will be 129 (128 + 1)
+ */
+ return LXC_MAINLOOP_CLOSE;
} else if (fd == terminal->peer) {
if (terminal->tty_state) {
lxc_terminal_signal_fini(terminal->tty_state);
--
1.8.3.1
2019-09-30 11:03:07 -04:00