From bb22a4c3d79d2ad60e00e77cdea7bc782414cf56 Mon Sep 17 00:00:00 2001 From: LiFeng Date: Tue, 21 May 2019 04:53:16 -0400 Subject: [PATCH 099/138] terminal: do not close the master fd of pty Signed-off-by: LiFeng --- 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