1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-03-07 17:28:15 +00:00

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
This commit is contained in:
Ryota Ozaki 2010-07-22 18:57:43 +02:00 committed by Daniel Veillard
parent ae3d31bf4f
commit 7af5f4689f

View File

@ -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;