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.
This commit is contained in:
parent
7d06b34ee2
commit
f2a614dcd3
1 changed files with 8 additions and 2 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue