mirror of
https://github.com/systemd/systemd.git
synced 2025-03-31 14:50:15 +03:00
udevadm: cleanup_dir: use dot_or_dot_dot()
which is safer than just checking dent[0]. Also, fix two style issues.
This commit is contained in:
parent
5888fa9b16
commit
28d6e85451
@ -232,12 +232,14 @@ static void cleanup_dir(DIR *dir, mode_t mask, int depth) {
|
||||
if (depth <= 0)
|
||||
return;
|
||||
|
||||
assert(dir);
|
||||
|
||||
FOREACH_DIRENT_ALL(dent, dir, break) {
|
||||
struct stat stats;
|
||||
|
||||
if (dent->d_name[0] == '.')
|
||||
if (dot_or_dot_dot(dent->d_name))
|
||||
continue;
|
||||
if (fstatat(dirfd(dir), dent->d_name, &stats, AT_SYMLINK_NOFOLLOW) != 0)
|
||||
if (fstatat(dirfd(dir), dent->d_name, &stats, AT_SYMLINK_NOFOLLOW) < 0)
|
||||
continue;
|
||||
if ((stats.st_mode & mask) != 0)
|
||||
continue;
|
||||
|
Loading…
x
Reference in New Issue
Block a user