From 3f693e033d127930eade0fa1ac64fa753f283999 Mon Sep 17 00:00:00 2001 From: Sean Whitton Date: Mon, 23 Mar 2020 11:59:31 -0700 Subject: locmaint: permit zero-size .keep when checking whether dirs empty --- bin/locmaint | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'bin/locmaint') diff --git a/bin/locmaint b/bin/locmaint index 67eea85b..c182ace0 100755 --- a/bin/locmaint +++ b/bin/locmaint @@ -593,13 +593,20 @@ Check whether C<$dir> contains any hidden or unhidden files, returning a true value if it does not, a false value if it does. If it does, print them. +As a special exception, ignore a zero-sized file named '.keep' (which +is used to prevent empty directories getting clobbered by things like +snap). + =cut sub empty_dir_or_list { my ($dir) = @_; opendir(my $dirh, $dir); - my @files = grep { $_ ne '.' && $_ ne '..' } readdir $dirh; + my @files + = grep $_ ne '.' + && $_ ne '..' + && !($_ eq ".keep" && -z catfile $dir, ".keep"), readdir $dirh; if (@files == 0) { return 1; -- cgit v1.2.3