stat-util: ignore hidden_or_backup_file when checking if dir is empty
authorLuca Boccassi <bluca@debian.org>
Sat, 30 Apr 2022 16:47:56 +0000 (17:47 +0100)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 1 May 2022 02:41:43 +0000 (11:41 +0900)
commitf470cb6d13558fc06131dc677d54a089a0b07359
tree0f6fa2a448b54a1ffaa51ca2086d1a6481239827
parentdfd672f84b95a6d9e1aaf28218f6e60d1664dff3
stat-util: ignore hidden_or_backup_file when checking if dir is empty

Commit https://github.com/systemd/systemd/commit/a068aceafbf
changed dir_is_emtpy_at to use FOREACH_DIRENT_IN_BUFFER instead of
FOREACH_DIRENT, but used dot_or_dotdot which just checks if the name
is literally '.' or '..' which is not enough, previous behaviour was
to ignore all hidden files, so restore that and add a test case.

Fixes https://github.com/systemd/systemd/issues/23220
src/basic/stat-util.c
src/test/test-stat-util.c