From: Lennart Poettering Date: Fri, 25 Jun 2021 21:47:02 +0000 (+0200) Subject: dirent-util: no need to bother with fstatat() for "." and ".." to figure out if these... X-Git-Tag: v250-rc1~974 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6a24c995f0c80f38bc87dc90649a62c465e5aad8;p=thirdparty%2Fsystemd.git dirent-util: no need to bother with fstatat() for "." and ".." to figure out if these are dirs --- diff --git a/src/basic/dirent-util.c b/src/basic/dirent-util.c index f6213a30535..aba14481df2 100644 --- a/src/basic/dirent-util.c +++ b/src/basic/dirent-util.c @@ -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;