From f2a614dcd3b3e473df29a91ca9a7de77ef9b2609 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Fri, 6 Aug 2021 08:23:01 +0000 Subject: seatd-launch: propagate child exit status When the child process exits with a non-zero code or is killed, return with a non-zero code as well. --- seatd-launch/seatd-launch.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/seatd-launch/seatd-launch.c b/seatd-launch/seatd-launch.c index ffa6cc6..1b53699 100644 --- a/seatd-launch/seatd-launch.c +++ b/seatd-launch/seatd-launch.c @@ -101,8 +101,9 @@ int main(int argc, char *argv[]) { goto error_seatd; } + int status = 0; while (true) { - pid_t p = waitpid(child, NULL, 0); + pid_t p = waitpid(child, &status, 0); if (p == child) { break; } else if (p == -1 && errno != EINTR) { @@ -113,7 +114,12 @@ int main(int argc, char *argv[]) { unlink(sockbuf); kill(seatd_child, SIGTERM); - return 0; + + if (WIFEXITED(status)) { + return WEXITSTATUS(status); + } else { + return 1; + } error_seatd: unlink(sockbuf); -- cgit v1.2.3