Commit b7ffd90
Apply modulo 256 to BSD WEXITSTATUS
wait(2p)[^1] says
> WEXITSTATUS(status)
> If WIFEXITED(status) is true, evaluates to the low-order 8 bits
> of the argument passed to _exit(2) or exit(3) by the child.
meaning WEXITSTATUS(status) is an 8-bit value. We accidentally return
too many bits. For example WEXITSTATUS(-1) returns -1 instead of 255.
Fix it, matching the C library and our other WEXITSTATUS implementations.
[^1] https://manpage.me/index.cgi?apropos=0&q=wait&sektion=2&manpath=FreeBSD+12-CURRENT+and+Ports&arch=default&format=html
Originally reported at fish-shell/fish-shell#10919
(backport <#4213>)
(cherry picked from commit f9cde2f)1 parent 1914da8 commit b7ffd90
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
639 | 639 | | |
640 | 640 | | |
641 | 641 | | |
642 | | - | |
| 642 | + | |
643 | 643 | | |
644 | 644 | | |
645 | 645 | | |
| |||
0 commit comments