From 6544e3d96330622d97ab1aad42a206fad1d2e27e Mon Sep 17 00:00:00 2001 From: zhangyao2022 Date: Sat, 30 Jul 2022 08:22:09 +0000 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0patch=E6=96=87=E4=BB=B6=20che?= =?UTF-8?q?rry-pick=20from:=20ef19ef88bb17c30e9cfb084c2ca4dbecc79b7e7d?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backport-fstat-dir-itself.patch | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 backport-fstat-dir-itself.patch diff --git a/backport-fstat-dir-itself.patch b/backport-fstat-dir-itself.patch new file mode 100644 index 0000000..66b52c6 --- /dev/null +++ b/backport-fstat-dir-itself.patch @@ -0,0 +1,33 @@ +From 2f26f8aae1ece618ff7ade997609509f0b60d400 Mon Sep 17 00:00:00 2001 +From: zhangyao +Date: Sat, 30 Jul 2022 10:38:37 +0800 +Subject: [PATCH] fstat dir itself + +--- + lib/path.c | 10 ++++++---- + 1 file changed, 6 insertions(+), 4 deletions(-) + +diff --git a/lib/path.c b/lib/path.c +index 21f9bd1..f0b010e 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 +-- +2.33.0 +