X-Git-Url: http://www.git.stargrave.org/?a=blobdiff_plain;f=lib%2FPublicInbox%2FEmergency.pm;h=b705e776e676c874ffc7ad0f6c00753bbe1e6e03;hb=9e0c2886493863b4bc6483ce0a3bfd3d599c8c87;hp=5ce75a797d6b6bc266f4a37edd4a626af61d5317;hpb=9bd675d33ad1e49bd2ebe12a1d216216e61380de;p=public-inbox.git diff --git a/lib/PublicInbox/Emergency.pm b/lib/PublicInbox/Emergency.pm index 5ce75a79..b705e776 100644 --- a/lib/PublicInbox/Emergency.pm +++ b/lib/PublicInbox/Emergency.pm @@ -1,4 +1,4 @@ -# Copyright (C) 2016-2019 all contributors +# Copyright (C) 2016-2020 all contributors # License: AGPL-3.0+ # # Emergency Maildir delivery for MDA @@ -7,16 +7,18 @@ use strict; use warnings; use Fcntl qw(:DEFAULT SEEK_SET); use Sys::Hostname qw(hostname); -use IO::Handle; +use IO::Handle; # ->flush, ->autoflush sub new { my ($class, $dir) = @_; - -d $dir or mkdir($dir) or die "failed to mkdir($dir): $!\n"; foreach (qw(new tmp cur)) { my $d = "$dir/$_"; next if -d $d; - -d $d or mkdir($d) or die "failed to mkdir($d): $!\n"; + require File::Path; + if (!File::Path::mkpath($d) && !-d $d) { + die "failed to mkpath($d): $!\n"; + } } bless { dir => $dir, files => {}, t => 0, cnt => 0, pid => $$ }, $class; }