diff options
Diffstat (limited to 'bin/autom4te.in')
-rw-r--r-- | bin/autom4te.in | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/bin/autom4te.in b/bin/autom4te.in index febcdeea..4c2b905c 100644 --- a/bin/autom4te.in +++ b/bin/autom4te.in @@ -1012,12 +1012,21 @@ if ($freeze) exit $exit_code; } -# We need our cache directory. Don't fail with parallel creation. -if (! -d "$cache") +# Ensure the cache directory exists. +if (! mkdir ($cache, 0755)) { - mkdir "$cache", 0755 - or -d "$cache" - or fatal "cannot create $cache: $!"; + # Snapshot $! immediately, the next few operations may clobber it. + my $eexist = $!{EEXIST}; + my $errmsg = "$!"; + + # If mkdir failed with EEXIST, that means the *name* $cache + # already exists, but it might be the wrong kind of file. + if (! $eexist || ! -d $cache) + { + require Cwd; + my $cwd = Cwd::cwd(); + fatal "cannot create $cache in $cwd: $errmsg"; + } } # Open the index for update, and lock it. autom4te handles several |