]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
start: fix container killing logic 3255/head
authorChristian Brauner <christian.brauner@ubuntu.com>
Thu, 16 Jan 2020 17:02:35 +0000 (18:02 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 16 Jan 2020 17:03:39 +0000 (18:03 +0100)
We need to account for the case where pidfd's are not supported by the kernel
in question.

Closes: #3254
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/start.c

index 9ca85911ce553e03ea814c3dad61aae4bbaf1c92..d70ffdf0e61d3d8c0798fa4ef16014778a0bbc87 100644 (file)
@@ -1094,11 +1094,13 @@ void lxc_abort(const char *name, struct lxc_handler *handler)
        if (handler->pidfd >= 0) {
                ret = lxc_raw_pidfd_send_signal(handler->pidfd, SIGKILL, NULL, 0);
                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))
-               SYSERROR("Failed to send SIGKILL to %d", handler->pid);
+       if (!ret || errno != ESRCH)
+               if (kill(handler->pid, SIGKILL))
+                       SYSWARN("Failed to send SIGKILL to %d", handler->pid);
 
        do {
                ret = waitpid(-1, &status, 0);