1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 18:18:12 +00:00

Kernel: Process::for_each_in_pgrp() should not include dead processes

We don't care about dead processes that were once members of a specific
process group.

This was causing us to try and send SIGINT to already-dead processes
when pressing Ctrl+C in a terminal whose pgrp they were once in.

Fixes #922.
This commit is contained in:
Andreas Kling 2019-12-26 22:20:39 +01:00
parent 43da941de5
commit 154d10e4e9

View file

@ -487,7 +487,7 @@ inline void Process::for_each_in_pgrp(pid_t pgid, Callback callback)
ASSERT_INTERRUPTS_DISABLED();
for (auto* process = g_processes->head(); process;) {
auto* next_process = process->next();
if (process->pgid() == pgid) {
if (!process->is_dead() && process->pgid() == pgid) {
if (callback(*process) == IterationDecision::Break)
break;
}