From: dms Date: Tue, 18 Dec 2001 16:28:59 +0000 (+0000) Subject: - woops. we can kill parent by mistake! X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=a833f9adc4575894f1a5e7a96f1551ab6e54054b;p=infobot.git - woops. we can kill parent by mistake! git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@533 c11ca15a-4712-0410-83d8-924469b57eb5 --- diff --git a/src/Shm.pl b/src/Shm.pl index 6412e4d..53db0ce 100644 --- a/src/Shm.pl +++ b/src/Shm.pl @@ -98,8 +98,14 @@ sub addForked { ### TODO: use &time2string()? &WARN("Fork: looks like we lost '$_', executed $time ago"); - if ( -d "/proc/$forked{$name}{PID}") { - my $pid = $forked{$name}{PID}; + my $pid = $forked{$name}{PID}; + # don't kill parent! + if ($pid == $$) { + &status("Fork: pid == \$\$ ($$)"); + next; + } + + if ( -d "/proc/$pid") { &status("Fork: killing $name ($pid)"); kill 9, $pid; }