diff options
author | Ali Mohammad Pur <ali.mpfard@gmail.com> | 2021-07-16 23:10:03 +0430 |
---|---|---|
committer | Ali Mohammad Pur <Ali.mpfard@gmail.com> | 2021-07-17 02:00:24 +0430 |
commit | 124ca30d49e615f169eb536c72c36fefd241a40f (patch) | |
tree | b6510b9405bd32160004355ffee4edf941ec436f /Userland | |
parent | 459aa44f6bd38225a29d0e46ae5d0fd82dc5d04d (diff) | |
download | serenity-124ca30d49e615f169eb536c72c36fefd241a40f.zip |
Shell: Don't assume that only the current shell may continue children
That can happen because of anyone sending the process a SIGCONT.
Fixes an issue where continuing a process launched by the shell from
the System Monitor would cause the shell to spin on waitpid().
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Shell/Shell.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Userland/Shell/Shell.cpp b/Userland/Shell/Shell.cpp index 487851f0cf..2c2a5fff29 100644 --- a/Userland/Shell/Shell.cpp +++ b/Userland/Shell/Shell.cpp @@ -1759,10 +1759,11 @@ void Shell::notify_child_event() } if (child_pid == 0) { // If the child existed, but wasn't dead. - if (job.is_suspended() && job.shell_did_continue()) { - // The job was suspended, and we sent it a SIGCONT. + if (job.is_suspended() || job.shell_did_continue()) { + // The job was suspended, and someone sent it a SIGCONT. job.set_is_suspended(false); - job.set_shell_did_continue(false); + if (job.shell_did_continue()) + job.set_shell_did_continue(false); found_child = true; } continue; |