From e2f5ca5af526f787b07fd23d5acd9205976d9390 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 6 Feb 2011 09:39:24 +0000 Subject: some bugfixing --- perldaemon.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/perldaemon.pl b/perldaemon.pl index c2289ab..2873c85 100644 --- a/perldaemon.pl +++ b/perldaemon.pl @@ -52,9 +52,11 @@ sub checkpid ($) { open my $fh, $pidfile or err $config => "Can't read pidfile $pidfile: $!"; my ($pid) = <$fh>; close $fh; - chomp $pid; - err $config => "Process with pid $pid already running" if 0 < int $pid && kill 0, $pid; + if (defined $pid) { + chomp $pid; + err $config => "Process with pid $pid already running" if 0 < int $pid && kill 0, $pid; + } } sub writepid ($) { -- cgit v1.2.3