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-07-09 04:18:09 +09:00
committed by Yu Watanabe
parent bcf8fc267f
commit 6a24c995f0
+5
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;