Fix SIGHUP not being sent to only the foreground process group.

This commit is contained in:
Jonas 'Sortie' Termansen 2024-06-18 22:10:15 +02:00
parent b6f2333bdd
commit 8b0911c672
1 changed files with 3 additions and 3 deletions

View File

@ -314,11 +314,11 @@ void TTY::hup()
ScopedLock lock(&termlock); ScopedLock lock(&termlock);
ScopedLock family_lock(&process_family_lock); ScopedLock family_lock(&process_family_lock);
hungup = true; hungup = true;
if ( 0 < sid ) if ( 0 < foreground_pgid )
{ {
Process* process = CurrentProcess()->GetPTable()->Get(sid); Process* process = CurrentProcess()->GetPTable()->Get(foreground_pgid);
if ( process ) if ( process )
process->DeliverSessionSignal(SIGHUP); process->DeliverGroupSignal(SIGHUP);
} }
kthread_cond_broadcast(&datacond); kthread_cond_broadcast(&datacond);
poll_channel.Signal(POLLHUP); poll_channel.Signal(POLLHUP);