Imported Upstream version 1.1.1l
[platform/upstream/openssl1.1.git] / util / mkdir-p.pl
index 3280602..b02db98 100755 (executable)
@@ -1,5 +1,5 @@
 #! /usr/bin/env perl
-# Copyright 1999-2016 The OpenSSL Project Authors. All Rights Reserved.
+# Copyright 1999-2021 The OpenSSL Project Authors. All Rights Reserved.
 #
 # Licensed under the OpenSSL license (the "License").  You may not use
 # this file except in compliance with the License.  You can obtain a copy
@@ -34,11 +34,12 @@ sub do_mkdir_p {
   }
 
   unless (mkdir($dir, 0777)) {
+    local($err) = $!;
     if (-d $dir) {
       # We raced against another instance doing the same thing.
       return;
     }
-    die "Cannot create directory $dir: $!\n";
+    die "Cannot create directory $dir: $err\n";
   }
   print "created directory `$dir'\n";
 }