2
0
mirror of git://github.com/lxc/lxc synced 2025-08-31 07:09:33 +00:00

conf: log termination status

Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
This commit is contained in:
Christian Brauner
2022-01-18 16:26:58 +01:00
parent 4eb09aaad4
commit bae0d71965

View File

@@ -5566,9 +5566,19 @@ on_error:
/* 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 */