Permalink
Browse files

Silence warnings when a pidfile is not set. Don't try to write a pidfile

if it has not been enabled in the settings.
  • Loading branch information...
lwsitu committed Mar 20, 2010
1 parent ec7487f commit d80bb7d446b3fe6a7592c21b6c6b0e10ebf736de
Showing with 2 additions and 1 deletion.
  1. +2 −1 lib/Bot/Pastebot/Administrivia.pm
@@ -41,7 +41,7 @@ sub get_pid {
my $name = _get_name();
my %conf = get_items_by_name($name);
my $pidfile = $conf{pidfile};
- return unless -e $pidfile;
+ return unless $pidfile && -e $pidfile;
my $pid = do {
local $/;
open my $fh, '<', $pidfile or die "open($pidfile): $!";
@@ -56,6 +56,7 @@ sub write_pidfile {
my $name = _get_name();
my %conf = get_items_by_name($name);
my $pidfile = $conf{pidfile};
+ return unless $pidfile;
open my $fh, '>', $pidfile or die "open($pidfile): $!";
print $fh $$;
close $fh;

0 comments on commit d80bb7d

Please sign in to comment.