]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
attach: don't ignore sigint/sigkill if stdin is redirected
authorSerge Hallyn <serge.hallyn@ubuntu.com>
Wed, 29 Oct 2014 15:03:14 +0000 (15:03 +0000)
committerStéphane Graber <stgraber@ubuntu.com>
Wed, 29 Oct 2014 15:23:02 +0000 (11:23 -0400)
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@ubuntu.com>
Acked-by: Stéphane Graber <stgraber@ubuntu.com>
src/lxc/attach.c

index 2318018692bb194a72f278a5dacb636d6cf08fd7..4010668b7f53465da7b13cdf8d83b37bf7d2dd31 100644 (file)
@@ -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);