summaryrefslogtreecommitdiff
path: root/src/shared/find-esp.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2023-04-11 04:57:34 +0900
committerYu Watanabe <watanabe.yu+github@gmail.com>2023-04-11 06:27:11 +0900
commitfb4d9bf47fcc647c3b43f0b61c6bcf0424397f03 (patch)
tree38dc050e14d810850830caea3e0c820af9a96b56 /src/shared/find-esp.c
parent75cc8d7c42ad2ad9b793bbdd96302a04e5d40a65 (diff)
downloadsystemd-fb4d9bf47fcc647c3b43f0b61c6bcf0424397f03.tar.gz
find-esp: use path_prefix_root_cwd()
Unlikely, but even if find_esp() or friends called with unnormalized or relative 'root', let's make the result path normalized and absolute. Note, before 63105f33edad423691e2d53bf7071f99c83799ba, these functions returned an absolute and normalized path. But the commit made the result path simply concatenated with root. Follow-up for 63105f33edad423691e2d53bf7071f99c83799ba.
Diffstat (limited to 'src/shared/find-esp.c')
-rw-r--r--src/shared/find-esp.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/shared/find-esp.c b/src/shared/find-esp.c
index 0d45249d63..6a0002a2bd 100644
--- a/src/shared/find-esp.c
+++ b/src/shared/find-esp.c
@@ -540,11 +540,9 @@ int find_esp_and_warn(
return r;
if (ret_path) {
- char *q = path_join(empty_to_root(root), p);
- if (!q)
- return -ENOMEM;
-
- *ret_path = TAKE_PTR(q);
+ r = path_prefix_root_cwd(p, root, ret_path);
+ if (r < 0)
+ return r;
}
if (ret_part)
*ret_part = part;
@@ -861,11 +859,9 @@ int find_xbootldr_and_warn(
return r;
if (ret_path) {
- char *q = path_join(empty_to_root(root), p);
- if (!q)
- return -ENOMEM;
-
- *ret_path = TAKE_PTR(q);
+ r = path_prefix_root_cwd(p, root, ret_path);
+ if (r < 0)
+ return r;
}
if (ret_uuid)
*ret_uuid = uuid;