OpenSSL::Test: Fix directory calculations in __cwd()
authorRichard Levitte <levitte@openssl.org>
Wed, 22 Jun 2016 11:39:46 +0000 (13:39 +0200)
committerRichard Levitte <levitte@openssl.org>
Wed, 22 Jun 2016 20:24:07 +0000 (22:24 +0200)
The previous fix contained a mistake, where any absolute path in
%directories would be cleared away instead of just being left alone.

Reviewed-by: Rich Salz <rsalz@openssl.org>
test/testlib/OpenSSL/Test.pm

index 6a10afd..31f4105 100644 (file)
@@ -854,7 +854,12 @@ sub __cwd {
        rmtree(".", { safe => 0, keep_root => 1 });
     }
 
-    %directories = %tmp_directories;
+    # We put back new values carefully.  Doing the obvious
+    # %directories = ( %tmp_irectories )
+    # will clear out any value that happens to be an absolute path
+    foreach (keys %tmp_directories) {
+        $directories{$_} = $tmp_directories{$_};
+    }
     foreach (keys %tmp_ENV) {
         $ENV{$_} = $tmp_ENV{$_};
     }