]> git.donarmstrong.com Git - debbugs.git/blobdiff - Debbugs/Common.pm
create directory for lockfiles if it doesn't exist
[debbugs.git] / Debbugs / Common.pm
index ae7d8b4724c32f693ab4ef76403e6b9ec9da2fa5..b0c6093c007301f840db44db591780d881101875 100644 (file)
@@ -74,6 +74,8 @@ use Mail::Address;
 use Cwd qw(cwd);
 use Storable qw(dclone);
 use Time::HiRes qw(usleep);
+use File::Path qw(mkpath);
+use File::Basename qw(dirname);
 
 use Params::Validate qw(validate_with :types);
 
@@ -792,6 +794,7 @@ sub lockpid {
          unlink $pidfile or
               die "Unable to unlink stale pidfile $pidfile $!";
      }
+     mkpath(dirname($pidfile));
      my $pidfh = IO::File->new($pidfile,O_CREAT|O_EXCL|O_WRONLY) or
          die "Unable to open $pidfile for writing: $!";
      print {$pidfh} $$ or die "Unable to write to $pidfile $!";