diff options
author | Simon Ser <contact@emersion.fr> | 2021-08-06 08:23:01 +0000 |
---|---|---|
committer | Kenny Levinsen <kl@kl.wtf> | 2021-08-06 22:27:42 +0200 |
commit | f2a614dcd3b3e473df29a91ca9a7de77ef9b2609 (patch) | |
tree | 26b8c1dbfe375836afb30b9c4685ede6b9346e74 /seatd-launch/seatd-launch.c | |
parent | 7d06b34ee248563a6c13d3ccfaa5370c0aa15d2d (diff) |
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.
Diffstat (limited to 'seatd-launch/seatd-launch.c')
-rw-r--r-- | seatd-launch/seatd-launch.c | 10 |
1 files 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); |