From b7e957d30f7ae5318bf6c294ef796bc75ca3fe20 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Thu, 20 Jul 2023 21:17:32 +0900 Subject: [PATCH] chase: drop CHASE_AT_RESOLVE_IN_ROOT earlier The flag will be anyway dropped in chaseat(), but let's shortcut. --- src/basic/chase.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/basic/chase.c b/src/basic/chase.c index 8f9c361a098..e66070b5d11 100644 --- a/src/basic/chase.c +++ b/src/basic/chase.c @@ -511,9 +511,14 @@ int chase(const char *path, const char *root, ChaseFlags flags, char **ret_path, return -EINVAL; /* A root directory of "/" or "" is identical to "/". */ - if (empty_or_root(root)) + if (empty_or_root(root)) { root = "/"; - else { + + /* When the root directory is "/", we will drop CHASE_AT_RESOLVE_IN_ROOT in chaseat(), + * hence below is not necessary, but let's shortcut. */ + flags &= ~CHASE_AT_RESOLVE_IN_ROOT; + + } else { r = path_make_absolute_cwd(root, &root_abs); if (r < 0) return r; -- 2.47.3