mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-24 05:25:13 +00:00
Kernel: Fix returning random children from waitid(WNOHANG)
In case WNOHANG was specified, we want to always set should_unblock to
true (which we do since commit 4402207b98
), not
wait_finished -- the latter causes us to immediately return this child to our
caller, which is not what we want -- perhaps we should return another child
which has actually exited or stopped, or nobody at all.
To avoid confusion, also rename wait_finished to fits_the_spec.
This fixes service keepalive functionality in SystemServer.
This commit is contained in:
parent
2c2ce5be64
commit
431bbde6df
Notes:
sideshowbarker
2024-07-19 06:09:36 +09:00
Author: https://github.com/bugaevc Commit: https://github.com/SerenityOS/serenity/commit/431bbde6dff Pull-request: https://github.com/SerenityOS/serenity/pull/2369 Reviewed-by: https://github.com/awesomekling
1 changed files with 3 additions and 4 deletions
|
@ -273,11 +273,10 @@ bool Thread::WaitBlocker::should_unblock(Thread& thread, time_t, long)
|
|||
});
|
||||
}
|
||||
|
||||
bool wait_finished = ((m_wait_options & WEXITED) && child_exited)
|
||||
|| ((m_wait_options & WSTOPPED) && child_stopped)
|
||||
|| (m_wait_options & WNOHANG);
|
||||
bool fits_the_spec = ((m_wait_options & WEXITED) && child_exited)
|
||||
|| ((m_wait_options & WSTOPPED) && child_stopped);
|
||||
|
||||
if (!wait_finished)
|
||||
if (!fits_the_spec)
|
||||
return IterationDecision::Continue;
|
||||
|
||||
m_waitee_pid = child.pid();
|
||||
|
|
Loading…
Add table
Reference in a new issue