From: Gurusamy Sarathy Date: Sun, 5 Dec 1999 09:01:19 +0000 (+0000) Subject: on dosish platforms, avoid infinite recursion in File::Path::mkpath() X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c342093359181c3927bdc4a1bd84f3a6efd5c4a5;p=p5sagit%2Fp5-mst-13.2.git on dosish platforms, avoid infinite recursion in File::Path::mkpath() when given non-existent drive names p4raw-id: //depot/perl@4651 --- diff --git a/lib/File/Path.pm b/lib/File/Path.pm index a82fd80..634b2cd 100644 --- a/lib/File/Path.pm +++ b/lib/File/Path.pm @@ -126,13 +126,15 @@ sub mkpath { my $parent = File::Basename::dirname($path); # Allow for creation of new logical filesystems under VMS if (not $Is_VMS or $parent !~ m:/[^/]+/000000/?:) { - push(@created,mkpath($parent, $verbose, $mode)) unless (-d $parent); + unless (-d $parent or $path eq $parent) { + push(@created,mkpath($parent, $verbose, $mode)); + } } print "mkdir $path\n" if $verbose; unless (mkdir($path,$mode)) { - my $e = $!; - # allow for another process to have created it meanwhile - croak "mkdir $path: $e" unless -d $path; + my $e = $!; + # allow for another process to have created it meanwhile + croak "mkdir $path: $e" unless -d $path; } push(@created, $path); }