attach: reset signal mask

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: 1349e92e4d ("console: exit mainloop on SIGTERM")
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
Christian Brauner 2018-10-07 11:21:06 +02:00
parent 969e23f2e1
commit f157b05636
No known key found for this signature in database
GPG Key ID: 8EB056D53EECB12D

View 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");