Skip to content

Commit

Permalink
conf: log termination status
Browse files Browse the repository at this point in the history
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
  • Loading branch information
Christian Brauner committed Jan 27, 2022
1 parent 4eb09aa commit bae0d71
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/lxc/conf.c
Expand Up @@ -5566,9 +5566,19 @@ int userns_exec_mapped_root(const char *path, int path_fd,

/* Wait for child to finish. */
if (pid < 0)
return -1;
return log_error(-1, "Failed to create child process");

return wait_for_pid(pid);
ret = lxc_wait_for_pid_status(pid);
if (ret < 0)
return syserror("Failed to wait on child process %d", pid);
if (WIFSIGNALED(ret))
return log_error(-1, "Child process %d terminated by signal %ld", pid, WTERMSIG(ret));
if (!WIFEXITED(ret))
return log_error(-1, "Child did not termiate correctly");
if (WEXITSTATUS(ret))
return log_error(-1, "Child terminated with error %ld", WEXITSTATUS(ret));

return 0;
}

/* not thread-safe, do not use from api without first forking */
Expand Down

0 comments on commit bae0d71

Please sign in to comment.