From: Lennart Poettering Date: Wed, 19 Aug 2020 16:27:52 +0000 (+0200) Subject: path-lookup: path_join() all the things! X-Git-Tag: v247-rc1~406^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=df778749b4a7ee540d9fde8f6c9066a1ddfda17d;p=thirdparty%2Fsystemd.git path-lookup: path_join() all the things! When we talk about paths, better use path_join(), who knows what callers pass to us, i.e. prefixed with "/" or not. --- diff --git a/src/basic/path-lookup.c b/src/basic/path-lookup.c index 52968dee342..3ea851c3385 100644 --- a/src/basic/path-lookup.c +++ b/src/basic/path-lookup.c @@ -27,7 +27,7 @@ int xdg_user_runtime_dir(char **ret, const char *suffix) { if (!e) return -ENXIO; - j = strjoin(e, suffix); + j = path_join(e, suffix); if (!j) return -ENOMEM; @@ -44,7 +44,7 @@ int xdg_user_config_dir(char **ret, const char *suffix) { e = getenv("XDG_CONFIG_HOME"); if (e) - j = strjoin(e, suffix); + j = path_join(e, suffix); else { _cleanup_free_ char *home = NULL; @@ -52,7 +52,7 @@ int xdg_user_config_dir(char **ret, const char *suffix) { if (r < 0) return r; - j = strjoin(home, "/.config", suffix); + j = path_join(home, "/.config", suffix); } if (!j) @@ -76,7 +76,7 @@ int xdg_user_data_dir(char **ret, const char *suffix) { e = getenv("XDG_DATA_HOME"); if (e) - j = strjoin(e, suffix); + j = path_join(e, suffix); else { _cleanup_free_ char *home = NULL; @@ -84,7 +84,7 @@ int xdg_user_data_dir(char **ret, const char *suffix) { if (r < 0) return r; - j = strjoin(home, "/.local/share", suffix); + j = path_join(home, "/.local/share", suffix); } if (!j) return -ENOMEM;