From 604a90c65668840645abfc852e26b35d4e24b81d Mon Sep 17 00:00:00 2001 From: LiFeng Date: Tue, 21 May 2019 04:53:16 -0400 Subject: [PATCH 099/131] 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 dfce92ed..88653b4f 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); -- 2.23.0