From: Ryota Ozaki Date: Thu, 22 Jul 2010 16:57:43 +0000 (+0200) Subject: lxc: force kill of init process by sending SIGKILL if needed X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=7af5f4689f63bc6ffec441178166c562fee28bc6;p=libvirt.git lxc: force kill of init process by sending SIGKILL if needed Init process may remain after sending SIGTERM for some reason. For example, if original init program is used, it is definitely not killed by SIGTERM. * src/lxc/lxc_controller.c: kill with SIGKILL if SIGTERM wasn't sufficient --- diff --git a/src/lxc/lxc_controller.c b/src/lxc/lxc_controller.c index 44bcc82015..d8b7bc7bf1 100644 --- a/src/lxc/lxc_controller.c +++ b/src/lxc/lxc_controller.c @@ -663,7 +663,11 @@ cleanup: close(containerPty); if (container > 1) { + int status; kill(container, SIGTERM); + if (!(waitpid(container, &status, WNOHANG) == 0 && + WIFEXITED(status))) + kill(container, SIGKILL); waitpid(container, NULL, 0); } return rc;