1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-30 23:21:22 +03:00

dirent-util: no need to bother with fstatat() for "." and ".." to figure out if these are dirs

This commit is contained in:
Lennart Poettering 2021-06-25 23:47:02 +02:00 committed by Yu Watanabe
parent bcf8fc267f
commit 6a24c995f0

View File

@ -16,6 +16,11 @@ static int dirent_ensure_type(DIR *d, struct dirent *de) {
if (de->d_type != DT_UNKNOWN)
return 0;
if (dot_or_dot_dot(de->d_name)) {
de->d_type = DT_DIR;
return 0;
}
if (fstatat(dirfd(d), de->d_name, &st, AT_SYMLINK_NOFOLLOW) < 0)
return -errno;