diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2000-05-28 18:21:51 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2000-05-28 18:21:51 +0000 |
commit | 704ea872433dd6d5a1c650f509289fdea5c037ab (patch) | |
tree | 801440e96af09797d4ab24460d550022d307e8c3 /lib/File/Find.pm | |
parent | 572149b7587624d5eb3b9ea2a06050a09056385f (diff) | |
download | perl-704ea872433dd6d5a1c650f509289fdea5c037ab.tar.gz |
File::Find fails to chdir when chasing symlinks (from
Helmut Jarausch <jarausch@igpm.rwth-aachen.de>)
p4raw-id: //depot/perl@6142
Diffstat (limited to 'lib/File/Find.pm')
-rw-r--r-- | lib/File/Find.pm | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/File/Find.pm b/lib/File/Find.pm index ac73f1b5eb..ef10e9d416 100644 --- a/lib/File/Find.pm +++ b/lib/File/Find.pm @@ -584,12 +584,24 @@ sub _find_dir_symlnk($$$) { while (defined $SE) { unless ($bydepth) { + # change to parent directory + unless ($no_chdir) { + my $udir = $pdir_loc; + if ($untaint) { + $udir = $1 if $pdir_loc =~ m|$untaint_pat|; + } + unless (chdir $udir) { + warn "Can't cd to $udir: $!\n"; + next; + } + } $dir= $p_dir; $name= $dir_name; $_= ($no_chdir ? $dir_name : $dir_rel ); $fullname= $dir_loc; # prune may happen here $prune= 0; + lstat($_); # make sure file tests with '_' work &$wanted_callback; next if $prune; } @@ -673,6 +685,7 @@ sub _find_dir_symlnk($$$) { s|/\.$||; } + lstat($_); # make sure file tests with '_' work &$wanted_callback; } else { push @Stack,[$dir_loc, $pdir_loc, $p_dir, $dir_rel,-1] if $bydepth; |