From: Jarkko Hietaniemi <jhi@iki.fi>
Date: Fri, 9 Mar 2001 15:25:05 +0000 (+0000)
Subject: In op/stat #35 better to scan all the potential directories
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=218d7377a71591af7a854208a27c04b399144aab;p=p5sagit%2Fp5-mst-13.2.git

In op/stat #35 better to scan all the potential directories
for setuids, not just the first one.

p4raw-id: //depot/perl@9091
---

diff --git a/t/op/stat.t b/t/op/stat.t
index 6c508eb..1d8c7a3 100755
--- a/t/op/stat.t
+++ b/t/op/stat.t
@@ -178,15 +178,18 @@ if ($^O eq 'mpeix' or $^O eq 'amigaos' or $Is_Dosish or $Is_Cygwin) {
 $cnt = $uid = 0;
 
 die "Can't run op/stat.t test 35 without pwd working" unless $cwd;
-($bin) = grep {-d} ($^O eq 'machten' ? qw(/usr/bin /bin) :
-		    		       qw(/sbin /usr/sbin /bin /usr/bin))
-    or print ("not ok 35\n"), goto tty_test;
-opendir BIN, $bin or die "Can't opendir $bin: $!";
-while (defined($_ = readdir BIN)) {
-    $_ = "$bin/$_";
-    $cnt++;
-    $uid++ if -u;
-    last if $uid && $uid < $cnt;
+my @bin = grep {-d} ($^O eq 'machten' ?
+		     qw(/usr/bin /bin) :
+		     qw(/sbin /usr/sbin /bin /usr/bin));
+unless (@bin) { print ("not ok 35\n"), goto tty_test; }
+for my $bin (@bin) {
+    opendir BIN, $bin or die "Can't opendir $bin: $!";
+    while (defined($_ = readdir BIN)) {
+        $_ = "$bin/$_";
+        $cnt++;
+        $uid++ if -u;
+        last if $uid && $uid < $cnt;
+    }
 }
 closedir BIN;