From 26371995cbc72ecf2ea35eccbe6ab15b37b10ed6 Mon Sep 17 00:00:00 2001 From: 4lDO2 <4lDO2@protonmail.com> Date: Thu, 17 Apr 2025 00:21:21 +0200 Subject: [PATCH] Fix kill(getpid(), ...). --- src/procmgr.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/procmgr.rs b/src/procmgr.rs index d2804c4cc6..7f59565a66 100644 --- a/src/procmgr.rs +++ b/src/procmgr.rs @@ -1095,7 +1095,7 @@ impl<'a> ProcScheme<'a> { // Forbid the caller from giving statuses corresponding to e.g. WIFCONTINUED which exit() // obviously can never be. - log::debug!("Killed with raw status {status:?}"); + log::trace!("Killed with raw status {status:?}"); // TODO: Are WIFEXITED and WIFSIGNALED mutually exclusive? let (status, signal) = if status & 0xff == status { @@ -1570,7 +1570,7 @@ impl<'a> ProcScheme<'a> { let match_grp = match target { ProcKillTarget::SingleProc(pid) => { - return self.on_send_sig( + self.on_send_sig( caller_pid, KillTarget::Proc(ProcessId(pid)), signal, @@ -1578,7 +1578,12 @@ impl<'a> ProcScheme<'a> { mode, is_sigchld_to_parent, awoken, - ) + )?; + return if killed_self { + Err(Error::new(ERESTART)) + } else { + Ok(()) + }; } ProcKillTarget::All => None, ProcKillTarget::ProcGroup(grp) => Some(ProcessId(grp)),