]> git.donarmstrong.com Git - infobot.git/commitdiff
- woops. we can kill parent by mistake!
authordms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Tue, 18 Dec 2001 16:28:59 +0000 (16:28 +0000)
committerdms <dms@c11ca15a-4712-0410-83d8-924469b57eb5>
Tue, 18 Dec 2001 16:28:59 +0000 (16:28 +0000)
git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@533 c11ca15a-4712-0410-83d8-924469b57eb5

src/Shm.pl

index 6412e4db531d6eac36ea6e1a850eef058204958d..53db0ce8cf5049fec5d268b0c2e0491b1bd30d09 100644 (file)
@@ -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;
        }