Skip to content

Commit

Permalink
attach: reset signal mask
Browse files Browse the repository at this point in the history
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: 1349e92 ("console: exit mainloop on SIGTERM")
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Oct 7, 2018
1 parent 1141d9f commit 8f03ee1
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lxc/attach.c
Expand Up @@ -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");
Expand Down

0 comments on commit 8f03ee1

Please sign in to comment.