fix barf on encountering an empty lockfile
authorDirk Koopman <djk@tobit.co.uk>
Tue, 20 Dec 2011 19:47:28 +0000 (19:47 +0000)
committerDirk Koopman <djk@tobit.co.uk>
Tue, 20 Dec 2011 19:47:28 +0000 (19:47 +0000)
Changes
perl/Version.pm
perl/cluster.pl

diff --git a/Changes b/Changes
index ee387f88197b05d62bcd521f78c18d4fd61fa6aa..728884b1bbcab325c17bad2173a4b51c62f3637b 100644 (file)
--- 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
index 0fa2a1db4cdc15cf6d25a9c04a90d9621697c581..4c2a374081b93e4bdfbe832c7c6656fba1a5d296 100644 (file)
@@ -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;
index a33e6da5f1a8e76b2907cf8547791702a146cdd9..5c3f0fb90a19c83fd59a4ffe5da2838fd90a9697 100755 (executable)
@@ -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 = <CLLOCK>;
-               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) $!";