summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--perldaemon.pl6
1 files 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 ($) {