From: dms Date: Thu, 8 Feb 2001 13:57:40 +0000 (+0000) Subject: possible fix for fork crashing and not detecting a crash from parent. warning included X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=d18c147b4a871f79a54940a6753b5f1958622507;p=infobot.git possible fix for fork crashing and not detecting a crash from parent. warning included git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@361 c11ca15a-4712-0410-83d8-924469b57eb5 --- diff --git a/src/Shm.pl b/src/Shm.pl index 3c50349..6811ff4 100644 --- a/src/Shm.pl +++ b/src/Shm.pl @@ -117,10 +117,17 @@ sub addForked { $count++; } - if (exists $forked{$name}) { + if (exists $forked{$name} and !scalar keys %{ $forked{$name} }) { + &WARN("addF: forked{$name} exists but is empty; deleting."); + undef $forked{$name}; + } + + if (exists $forked{$name} and scalar keys %{ $forked{$name} }) { my $time = $forked{$name}{Time}; my $continue = 0; + &DEBUG("PID => $forked{$name}{PID}"); + if (-d "/proc/$forked{$name}{PID}") { &status("fork: still running; good. BAIL OUT."); } else {