seatd-launch: exit with status >128 if child is signalled
Mimick shells and exit with a status >128 if our child has been signalled. Exiting with 128 + signal number is what most shells do (POSIX only requires them to exit with >128).
This commit is contained in:
parent
8c85c46d2d
commit
fe600eac2b
2 changed files with 11 additions and 1 deletions
|
@ -38,6 +38,14 @@ superior to it for two reasons:
|
||||||
. The specified command never runs as root
|
. The specified command never runs as root
|
||||||
. The standard seatd executable and libseat backend is used
|
. The standard seatd executable and libseat backend is used
|
||||||
|
|
||||||
|
# EXIT STATUS
|
||||||
|
|
||||||
|
seatd-launch exits with the status of its child. When the child terminates on
|
||||||
|
a signal _N_, seatd-launch exits with the status 128 + _N_.
|
||||||
|
|
||||||
|
If seatd-launch fails because of another error, it exits with a non-zero
|
||||||
|
status.
|
||||||
|
|
||||||
# SEE ALSO
|
# SEE ALSO
|
||||||
|
|
||||||
The libseat library, *<libseat.h>*, *seatd*(1)
|
The libseat library, *<libseat.h>*, *seatd*(1)
|
||||||
|
|
|
@ -166,8 +166,10 @@ int main(int argc, char *argv[]) {
|
||||||
|
|
||||||
if (WIFEXITED(status)) {
|
if (WIFEXITED(status)) {
|
||||||
return WEXITSTATUS(status);
|
return WEXITSTATUS(status);
|
||||||
|
} else if (WIFSIGNALED(status)) {
|
||||||
|
return 128 + WTERMSIG(status);
|
||||||
} else {
|
} else {
|
||||||
return 1;
|
abort(); // unreachable
|
||||||
}
|
}
|
||||||
|
|
||||||
error_seatd:
|
error_seatd:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue