]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
lxccontainer: use wait_for_pid()
authorChristian Brauner <christian.brauner@ubuntu.com>
Sun, 18 Feb 2018 20:43:46 +0000 (21:43 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Wed, 21 Feb 2018 16:59:40 +0000 (17:59 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/lxccontainer.c

index 5b211211d59ce7ef3e2a8ccc1b03d16017afd823..511ba2f4d7edd7f03b0be1810059aefba1ace4c0 100644 (file)
@@ -718,7 +718,7 @@ again:
 
 static bool wait_on_daemonized_start(struct lxc_handler *handler, int pid)
 {
-        int state, status;
+        int ret, state;
 
         /* Close write end of the socket pair. */
         close(handler->state_socket_pair[1]);
@@ -733,12 +733,11 @@ static bool wait_on_daemonized_start(struct lxc_handler *handler, int pid)
         /* The first child is going to fork() again and then exits. So we reap
          * the first child here.
          */
-        if (waitpid(pid, &status, 0) < 0)
-                DEBUG("Failed waiting on first child");
-        else if (!WIFEXITED(status))
-                DEBUG("Failed to retrieve exit status of first child");
-        else if (WEXITSTATUS(status) != 0)
-                DEBUG("First child exited with: %d", WEXITSTATUS(status));
+       ret = wait_for_pid(pid);
+       if (ret < 0)
+                DEBUG("Failed waiting on first child %d", pid);
+       else
+                DEBUG("First child %d exited", pid);
 
         if (state < 0) {
                 SYSERROR("Failed to receive the container state");