Assume file has vanished if we can't lstat it

A file might be deleted between the time we read the directory and the
time we get around to check it, so if we can't lstat it, assume that is
what has happened. (It might also have been renamed, but that's
equivalent to this file being deleted and another being created, so we
don't have to treat this specially)
This commit is contained in:
Peter J. Holzer 2016-10-04 23:59:58 +02:00
parent f3d48b2cdc
commit 473a272066
1 changed files with 4 additions and 0 deletions

View File

@ -97,6 +97,10 @@ sub cleandir {
print STDERR "$0:", " " x $level, " checking $dir/$i\n";
}
my $st = lstat("$i");
if (!defined($st)) {
# file has vanished
next;
}
my $action = 'i';
# Skip anything on a different filesystem