提交 8aee48bd 编写于 作者: E Eric Blake

lxc: use common code for process cleanup

Based on a Coverity report - the return value of waitpid() should
always be checked, to avoid problems with leaking resources.

* src/lxc/lxc_controller.c (lxcControllerRun): Use simpler virPidAbort.
上级 209c2880
......@@ -59,6 +59,7 @@
#include "util.h"
#include "virfile.h"
#include "virpidfile.h"
#include "command.h"
#define VIR_FROM_THIS VIR_FROM_LXC
......@@ -1266,14 +1267,8 @@ cleanup:
VIR_FORCE_CLOSE(loopDevs[i]);
VIR_FREE(loopDevs);
if (container > 1) {
int status;
kill(container, SIGTERM);
if (!(waitpid(container, &status, WNOHANG) == 0 &&
WIFEXITED(status)))
kill(container, SIGKILL);
waitpid(container, NULL, 0);
}
virPidAbort(container);
return rc;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册