mirror of
https://git.proxmox.com/git/mirror_lxc
synced 2025-07-27 09:48:32 +00:00
lxccontainer: use wait_for_pid()
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
parent
b2ac2cb755
commit
01c1b11e45
@ -746,7 +746,7 @@ again:
|
|||||||
|
|
||||||
static bool wait_on_daemonized_start(struct lxc_handler *handler, int pid)
|
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 write end of the socket pair. */
|
||||||
close(handler->state_socket_pair[1]);
|
close(handler->state_socket_pair[1]);
|
||||||
@ -761,12 +761,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 is going to fork() again and then exits. So we reap
|
||||||
* the first child here.
|
* the first child here.
|
||||||
*/
|
*/
|
||||||
if (waitpid(pid, &status, 0) < 0)
|
ret = wait_for_pid(pid);
|
||||||
DEBUG("Failed waiting on first child");
|
if (ret < 0)
|
||||||
else if (!WIFEXITED(status))
|
DEBUG("Failed waiting on first child %d", pid);
|
||||||
DEBUG("Failed to retrieve exit status of first child");
|
else
|
||||||
else if (WEXITSTATUS(status) != 0)
|
DEBUG("First child %d exited", pid);
|
||||||
DEBUG("First child exited with: %d", WEXITSTATUS(status));
|
|
||||||
|
|
||||||
if (state < 0) {
|
if (state < 0) {
|
||||||
SYSERROR("Failed to receive the container state");
|
SYSERROR("Failed to receive the container state");
|
||||||
|
Loading…
Reference in New Issue
Block a user