From: Karel Zak Date: Mon, 6 Sep 2021 09:52:09 +0000 (+0200) Subject: lib/path: fstat dir itself X-Git-Tag: v2.38-rc1~144^2~115 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2f26f8aae1ece618ff7ade997609509f0b60d400;p=thirdparty%2Futil-linux.git lib/path: fstat dir itself Signed-off-by: Karel Zak --- diff --git a/lib/path.c b/lib/path.c index 21f9bd1c46..f0b010e67e 100644 --- a/lib/path.c +++ b/lib/path.c @@ -350,10 +350,12 @@ int ul_path_stat(struct path_cxt *pc, struct stat *sb, const char *path) int dir = ul_path_get_dirfd(pc); if (dir < 0) return dir; - if (*path == '/') - path++; - - rc = fstatat(dir, path, sb, 0); + if (path) { + if (*path == '/') + path++; + rc = fstatat(dir, path, sb, 0); + } else + rc = fstat(dir, sb); /* dir itself */ if (rc && errno == ENOENT && pc->redirect_on_enoent