]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
start: fix waitpid() blocking issue
authorDonghwa Jeong <dh48.jeong@samsung.com>
Thu, 31 May 2018 08:58:08 +0000 (17:58 +0900)
committerChristian Brauner <christian.brauner@ubuntu.com>
Mon, 10 Dec 2018 07:49:44 +0000 (08:49 +0100)
Signed-off-by: Donghwa Jeong <dh48.jeong@samsung.com>
src/lxc/start.c

index be4b1762c7594bd56f7140973f1ee9df2c243ad2..962b7a1fc294f590e936970f10836f0fa7cbcf66 100644 (file)
@@ -1824,8 +1824,14 @@ int __lxc_start(const char *name, struct lxc_handler *handler,
                goto out_abort;
        }
 
-       while (waitpid(handler->pid, &status, 0) < 0 && errno == EINTR)
-               continue;
+       if (!handler->init_died && handler->pid > 0) {
+               ERROR("Child process is not killed");
+               goto out_abort;
+       }
+
+       status = lxc_wait_for_pid_status(handler->pid);
+       if (status < 0)
+               SYSERROR("Failed to retrieve status for %d", handler->pid);
 
        /* If the child process exited but was not signaled, it didn't call
         * reboot. This should mean it was an lxc-execute which simply exited.