From 8b0911c6721debb526700766cff9870590a78ef4 Mon Sep 17 00:00:00 2001 From: Jonas 'Sortie' Termansen Date: Tue, 18 Jun 2024 22:10:15 +0200 Subject: [PATCH] Fix SIGHUP not being sent to only the foreground process group. --- kernel/tty.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/tty.cpp b/kernel/tty.cpp index 66a78305..c31f34c8 100644 --- a/kernel/tty.cpp +++ b/kernel/tty.cpp @@ -314,11 +314,11 @@ void TTY::hup() ScopedLock lock(&termlock); ScopedLock family_lock(&process_family_lock); hungup = true; - if ( 0 < sid ) + if ( 0 < foreground_pgid ) { - Process* process = CurrentProcess()->GetPTable()->Get(sid); + Process* process = CurrentProcess()->GetPTable()->Get(foreground_pgid); if ( process ) - process->DeliverSessionSignal(SIGHUP); + process->DeliverGroupSignal(SIGHUP); } kthread_cond_broadcast(&datacond); poll_channel.Signal(POLLHUP);