Re: [REPATCH] Re: [PATCH] Re: [ID 20011030.064] File::Temp tempdir(CLEANUP => 1)...
[p5sagit/p5-mst-13.2.git] / lib / File / Path.pm
index 3560a97..10ae398 100644 (file)
@@ -98,7 +98,7 @@ use Exporter ();
 use strict;
 use warnings;
 
-our $VERSION = "1.0405";
+our $VERSION = "1.05";
 our @ISA = qw( Exporter );
 our @EXPORT = qw( mkpath rmtree );
 
@@ -180,7 +180,13 @@ sub rmtree {
                unless $safe;
 
            if (opendir my $d, $root) {
-               @files = readdir $d;
+               no strict 'refs';
+               if (!defined ${"\cTAINT"} or ${"\cTAINT"}) {
+                   # Blindly untaint dir names
+                   @files = map { /^(.*)$/s ; $1 } readdir $d;
+               } else {
+                   @files = readdir $d;
+               }
                closedir $d;
            }
            else {