From 84fb1f6e7089c24454eeb92bf093e31682db4489 Mon Sep 17 00:00:00 2001 From: Dirk Koopman Date: Tue, 20 Dec 2011 19:47:28 +0000 Subject: [PATCH] fix barf on encountering an empty lockfile --- Changes | 3 +++ perl/Version.pm | 4 ++-- perl/cluster.pl | 9 ++++++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Changes b/Changes index ee387f88..728884b1 100644 --- a/Changes +++ b/Changes @@ -1,3 +1,6 @@ +20Dec11======================================================================= +1. fix strange startup repeating lockfile issue where (somehow) there is an +empty (but existing) lockfile, from GB7YDX. 29Nov11======================================================================= 1. fix shutdown() in Msg.pm 2. Add CTY2117 changes diff --git a/perl/Version.pm b/perl/Version.pm index 0fa2a1db..4c2a3740 100644 --- a/perl/Version.pm +++ b/perl/Version.pm @@ -11,7 +11,7 @@ use vars qw($version $subversion $build $gitversion); $version = '1.55'; $subversion = '0'; -$build = '98'; -$gitversion = '192c703'; +$build = '99'; +$gitversion = '3c2ea66'; 1; diff --git a/perl/cluster.pl b/perl/cluster.pl index a33e6da5..5c3f0fb9 100755 --- a/perl/cluster.pl +++ b/perl/cluster.pl @@ -34,11 +34,14 @@ BEGIN { # try to create and lock a lockfile (this isn't atomic but # should do for now $lockfn = "$root/local/cluster.lck"; # lock file name - if (-e $lockfn) { + if (-w $lockfn) { open(CLLOCK, "$lockfn") or die "Can't open Lockfile ($lockfn) $!"; my $pid = ; - chomp $pid; - die "Lockfile ($lockfn) and process $pid exist, another cluster running?" if kill 0, $pid; + if ($pid) { + chomp $pid; + die "Lockfile ($lockfn) and process $pid exist, another cluster running?" if kill 0, $pid; + } + unlink $lockfn; close CLLOCK; } open(CLLOCK, ">$lockfn") or die "Can't open Lockfile ($lockfn) $!"; -- 2.43.0