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>
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)