]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
attach: reset signal mask 2677/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Sun, 7 Oct 2018 09:21:06 +0000 (11:21 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Sun, 7 Oct 2018 09:50:23 +0000 (11:50 +0200)
Since we introduced clean exit from the mainloop when SIGTERM is sent we
changed the signal mask of the parent process but we never reset the
signal mask for the actual attached process.

Closes #399.

Fixes: 1349e92e4d23 ("console: exit mainloop on SIGTERM")
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/attach.c

index 689cef7090371c88f6d6b19cb0eb3a3778533829..e46d742c55c049fdb8bf15a8c6b8bcca7f92643f 100644 (file)
@@ -1483,6 +1483,15 @@ int lxc_attach(const char *name, const char *lxcpath,
        }
 
        if (pid == 0) {
+               if (options->attach_flags & LXC_ATTACH_TERMINAL) {
+                       ret = pthread_sigmask(SIG_SETMASK,
+                                             &terminal.tty_state->oldmask, NULL);
+                       if (ret < 0) {
+                               SYSERROR("Failed to reset signal mask");
+                               _exit(EXIT_FAILURE);
+                       }
+               }
+
                ret = attach_child_main(&payload);
                if (ret < 0)
                        ERROR("Failed to exec");