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 <dlezc...@fr.ibm.com> --- src/lxc/lxc_init.c | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/lxc/lxc_init.c b/src/lxc/lxc_init.c index 5e0da5e..d91a3a1 100644 --- a/src/lxc/lxc_init.c +++ b/src/lxc/lxc_init.c @@ -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) -- 1.7.0.4 ------------------------------------------------------------------------------ This SF.net email is sponsored by Sprint What will you do first with EVO, the first 4G phone? Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first _______________________________________________ Lxc-devel mailing list Lxc-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lxc-devel