mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-08-04 07:34:19 +00:00
lxc-init kills all processes with SIGTERM
When lxc-init receives a SIGTERM, let's kill all the processes of the pid namespace with kill -1. So the exit of the container will happen gracefully with processes death cascade. Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
This commit is contained in:
parent
83ee787579
commit
6fd1668e7f
@ -154,11 +154,21 @@ int main(int argc, char *argv[])
|
||||
int orphan = 0;
|
||||
pid_t waited_pid;
|
||||
|
||||
if (was_interrupted) {
|
||||
switch (was_interrupted) {
|
||||
|
||||
case 0:
|
||||
break;
|
||||
|
||||
case SIGTERM:
|
||||
kill(-1, SIGTERM);
|
||||
break;
|
||||
|
||||
default:
|
||||
kill(pid, was_interrupted);
|
||||
was_interrupted = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
was_interrupted = 0;
|
||||
waited_pid = wait(&status);
|
||||
if (waited_pid < 0) {
|
||||
if (errno == ECHILD)
|
||||
|
Loading…
Reference in New Issue
Block a user