添加patch文件

cherry-pick from: ef19ef88bb17c30e9cfb084c2ca4dbecc79b7e7d
This commit is contained in:
zhangyao2022 2022-07-30 08:22:09 +00:00 committed by z30031144
parent a157a9ab24
commit 6544e3d963

View File

@ -0,0 +1,33 @@
From 2f26f8aae1ece618ff7ade997609509f0b60d400 Mon Sep 17 00:00:00 2001
From: zhangyao <zhangyao108@huawei.com>
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