Bugfix: if sem is locked by a dead process, release the lock

This commit is contained in:
Ole Tange 2011-04-17 02:59:16 +02:00
parent 1f3c0aa2c2
commit bc0f875e86

View file

@ -4072,7 +4072,8 @@ sub acquire {
::debug("Remove dead locks"); ::debug("Remove dead locks");
my $lockdir = $self->{'lockdir'}; my $lockdir = $self->{'lockdir'};
for my $d (<$lockdir/*>) { for my $d (<$lockdir/*>) {
$d =~ m:$lockdir/([0-9]+)\@([-\._a-z0-9])$:o or next; ::debug("Lock $d $lockdir\n");
$d =~ m:$lockdir/([0-9]+)\@([-\._a-z0-9]+)$:o or next;
my ($pid, $host) = ($1,$2); my ($pid, $host) = ($1,$2);
if($host eq ::hostname()) { if($host eq ::hostname()) {
if(not kill 0, $1) { if(not kill 0, $1) {