start: fix container killing logic

We need to account for the case where pidfd's are not supported by the kernel in question. Closes: #3254 Signed-off-by: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent 3de45bf6
...@@ -1079,11 +1079,13 @@ void lxc_abort(const char *name, struct lxc_handler *handler) ...@@ -1079,11 +1079,13 @@ void lxc_abort(const char *name, struct lxc_handler *handler)
if (handler->pidfd >= 0) { if (handler->pidfd >= 0) {
ret = lxc_raw_pidfd_send_signal(handler->pidfd, SIGKILL, NULL, 0); ret = lxc_raw_pidfd_send_signal(handler->pidfd, SIGKILL, NULL, 0);
if (ret) if (ret)
SYSWARN("Failed to send SIGKILL via pidfd %d for process %d", handler->pidfd, handler->pid); SYSWARN("Failed to send SIGKILL via pidfd %d for process %d",
handler->pidfd, handler->pid);
} }
if (ret && (errno != ESRCH) && kill(handler->pid, SIGKILL)) if (!ret || errno != ESRCH)
SYSERROR("Failed to send SIGKILL to %d", handler->pid); if (kill(handler->pid, SIGKILL))
SYSWARN("Failed to send SIGKILL to %d", handler->pid);
do { do {
ret = waitpid(-1, &status, 0); ret = waitpid(-1, &status, 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment