Testsuite: locate.pl: do not try folders we do not have permissions for
authorHeiko Schlittermann (HS12-RIPE) <hs@schlittermann.de>
Fri, 19 Jan 2018 08:40:24 +0000 (09:40 +0100)
committerHeiko Schlittermann (HS12-RIPE) <hs@schlittermann.de>
Sat, 27 Jan 2018 22:01:23 +0000 (23:01 +0100)
test/src/locate.pl

index 6f752c13794c15d78f90c6492efdd0ab1bf7f3ab..2eb319cdddce2e0528f274a82737dac6e5037058 100644 (file)
@@ -1,4 +1,6 @@
 #!/usr/bin/env perl
+
+use 5.010;
 use strict;
 use warnings;
 use File::Find;
@@ -39,7 +41,8 @@ sub locate {
     eval {
         find(
             sub {
-                return unless $tool eq $_ and -x $_ and -f _;
+                return $File::Find::prune = 1 unless -r -x -r;
+                return unless $tool eq $_ and -x and -f _;
                 die { found => $File::Find::name };
             },
             @dirs