1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-10 04:27:35 +00:00

Shell: Do not assume that wstatus is valid after wait() returns 0

According to the linux waitid manpage, the value of wstatus is
unspecified if wait() returns 0, so we should not assume that any
value it holds is correct (including the exit code).
This is only applicable to the Lagom build.
This commit is contained in:
AnotherTest 2020-07-28 06:34:07 +04:30 committed by Andreas Kling
parent 681bb1fb23
commit 4be2cb895c

View file

@ -99,7 +99,7 @@ int main(int argc, char** argv)
#ifndef __serenity__
if (child_pid == 0) {
// Linux: if child didn't "change state", but existed.
child_pid = job.value->pid();
continue;
}
#endif
if (child_pid == job.value->pid()) {