From: Ruben Schattevoy Date: Thu, 7 Aug 1997 00:00:00 +0000 (+0000) Subject: Allow concurrent mkdir in File::Path::mkpath X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=67e4c82827d14b0591d9026f03f3db887b698636;p=p5sagit%2Fp5-mst-13.2.git Allow concurrent mkdir in File::Path::mkpath private-msgid: 199707300943.LAA21574@kant.imb-jena.de --- diff --git a/lib/File/Path.pm b/lib/File/Path.pm index fe56ae5..43856df 100644 --- a/lib/File/Path.pm +++ b/lib/File/Path.pm @@ -130,7 +130,10 @@ sub mkpath { my $parent = File::Basename::dirname($path); push(@created,mkpath($parent, $verbose, $mode)) unless (-d $parent); print "mkdir $path\n" if $verbose; - mkdir($path,$mode) || croak "mkdir $path: $!"; + unless (mkdir($path,$mode)) { + # allow for another process to have created it meanwhile + croak "mkdir $path: $!" unless -d $path; + } push(@created, $path); } @created;