From b544c3be9dfe2e98386ea988c07c176b2de6d18e Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Thu, 29 Mar 2018 13:45:23 -0700 Subject: [PATCH] create directory for lockfiles if it doesn't exist --- Debbugs/Common.pm | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Debbugs/Common.pm b/Debbugs/Common.pm index ae7d8b4..b0c6093 100644 --- a/Debbugs/Common.pm +++ b/Debbugs/Common.pm @@ -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 $!"; -- 2.39.2