From 32fc7001ce9cf835e3897d026d27af24e067f7ed Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Fri, 29 Apr 2022 17:49:44 +0100 Subject: [PATCH] mason/.perl-lib/TrivGal.pm: Fix behaviour for `unreadable' directories. They can be listed in the parent, but their contents is secret. --- mason/.perl-lib/TrivGal.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/mason/.perl-lib/TrivGal.pm b/mason/.perl-lib/TrivGal.pm index 5b5cbfa..39c6913 100644 --- a/mason/.perl-lib/TrivGal.pm +++ b/mason/.perl-lib/TrivGal.pm @@ -295,6 +295,9 @@ sub listdir ($) { if ($item && $comment) { $item->comment($comment); } close $f; } else { + my $st = stat "$path/$e"; + unless ($st->mode&0004) { return ([], [], undef); } + opendir $d, $path; my @e = readdir $d; closedir $d; @@ -304,7 +307,7 @@ sub listdir ($) { my $dotp = $e =~ /^\./; my $st = stat "$path/$e"; my $list = undef; - if ($dotp || !($st->mode&0004)) { } + if ($dotp) { } elsif (-d $st) { $list = \@d; } elsif ($TYPE{lc $ext} && -f $st) { $list = \@f; } $list and push @$list, TrivGal::Item->new($e); -- 2.11.0