lxc/0099-terminal-do-not-close-the-master-fd-of-pty.patch
LiFeng c1c967d9bc lxc: make lxc-libs package
Signed-off-by: LiFeng <lifeng68@huawei.com>
2020-02-14 06:13:22 -05:00

29 lines
943 B
Diff

From 0c622aaccfa9ea9bb79fcc6fb1e6643ccc25858b Mon Sep 17 00:00:00 2001
From: LiFeng <lifeng68@huawei.com>
Date: Tue, 21 May 2019 04:53:16 -0400
Subject: [PATCH 099/139] terminal: do not close the master fd of pty
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
--- 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