34 lines
815 B
Diff
34 lines
815 B
Diff
|
|
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
|
||
|
|
|