Re: [ID 20011206.006] File::Find calls lstat on wrong object before wanted()
[p5sagit/p5-mst-13.2.git] / lib / File / Find.pm
index f43329d..3fbeebc 100644 (file)
@@ -718,6 +718,8 @@ sub _find_dir($$$) {
            $_= ($no_chdir ? $dir_name : $dir_rel ); # $_
            # prune may happen here
            $prune= 0;
+            # guarantee lstat for directory
+            lstat( $dir_name );
            { &$wanted_callback };      # protect against wild "next"
            next if $prune;
        }
@@ -869,6 +871,8 @@ sub _find_dir($$$) {
                        s|/\.$||;
                    }
                }
+                # guarantee lstat at return to directory
+               lstat( $dir_name );
                { &$wanted_callback }; # protect against wild "next"
             }
             else {