summaryrefslogtreecommitdiffstats
path: root/src/shared/varlink.c
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2023-10-07 08:53:44 +0200
committerYu Watanabe <watanabe.yu+github@gmail.com>2023-10-07 09:00:03 +0200
commitcf3d95b25dadaf59ac503538f8e989f90bc36638 (patch)
treed1074b77656905044bf2aca5976f35777f7394f1 /src/shared/varlink.c
parentvarlink: drop unnecessary condition (diff)
downloadsystemd-cf3d95b25dadaf59ac503538f8e989f90bc36638.tar.xz
systemd-cf3d95b25dadaf59ac503538f8e989f90bc36638.zip
tree-wide: use path_simplify_alloc() more
Diffstat (limited to '')
-rw-r--r--src/shared/varlink.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/shared/varlink.c b/src/shared/varlink.c
index 1d6e7fb64e..121de882bb 100644
--- a/src/shared/varlink.c
+++ b/src/shared/varlink.c
@@ -501,6 +501,7 @@ int varlink_connect_url(Varlink **ret, const char *url) {
_cleanup_free_ char *c = NULL;
const char *p;
bool exec;
+ int r;
assert_return(ret, -EINVAL);
assert_return(url, -EINVAL);
@@ -533,11 +534,9 @@ int varlink_connect_url(Varlink **ret, const char *url) {
if (!path_is_absolute(p))
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "Specified path not absolute, refusing.");
- c = strdup(p);
- if (!c)
- return log_oom_debug();
-
- path_simplify(c);
+ r = path_simplify_alloc(p, &c);
+ if (r < 0)
+ return r;
if (!path_is_normalized(c))
return log_debug_errno(SYNTHETIC_ERRNO(EINVAL), "Specified path is not normalized, refusing.");