[lxc-devel] [PATCH] attach: don't ignore sigint/sigkill if stdin is redirected

Serge Hallyn serge.hallyn at ubuntu.com
Wed Oct 29 15:03:14 UTC 2014


If attach is being done over passed-in fds, then we shouldn't
mess with the caller's signal table to ignore ctrl-c over the
fd.

Signed-off-by: Serge Hallyn <serge.hallyn at ubuntu.com>
---
 src/lxc/attach.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/lxc/attach.c b/src/lxc/attach.c
index 2318018..4010668 100644
--- a/src/lxc/attach.c
+++ b/src/lxc/attach.c
@@ -758,8 +758,10 @@ int lxc_attach(const char* name, const char* lxcpath, lxc_attach_exec_t exec_fun
 		}
 
 		/* ignore SIGKILL (CTRL-C) and SIGQUIT (CTRL-\) - issue #313 */
-		signal(SIGINT, SIG_IGN);
-		signal(SIGQUIT, SIG_IGN);
+		if (options->stdin_fd == 0) {
+			signal(SIGINT, SIG_IGN);
+			signal(SIGQUIT, SIG_IGN);
+		}
 
 		/* reap intermediate process */
 		ret = wait_for_pid(pid);
-- 
2.1.0



More information about the lxc-devel mailing list