]> 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>
Tue, 25 Nov 2014 22:12:44 +0000 (17:12 -0500)
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 6e5d7b57d48bdd3f3e303f180a3d2bf9699bb839..1667d74448ea6a573958b2e93875430737a0f5a9 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);