diff options
| author | Paul Buetow <paul@buetow.org> | 2011-02-06 09:39:24 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2011-02-06 09:39:24 +0000 |
| commit | e2f5ca5af526f787b07fd23d5acd9205976d9390 (patch) | |
| tree | 155f578284772562e75d27e3d884c57cb5617770 | |
| parent | 93e3a0775cc9a5b0da83708654bdde124825cc57 (diff) | |
some bugfixingv1.0
| -rw-r--r-- | perldaemon.pl | 6 |
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 ($) { |
