Re: [ID 20011206.006] File::Find calls lstat on wrong object before wanted()
Wolfgang Laun [Sun, 9 Dec 2001 13:40:58 +0000 (14:40 +0100)]
Message-ID: <200112091340580550.008ED513@smtp.chello.at>

(The lstat()s were there in 5.6.1: what happened to them?)

p4raw-id: //depot/perl@13559

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 {