From df778749b4a7ee540d9fde8f6c9066a1ddfda17d Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 19 Aug 2020 18:27:52 +0200 Subject: [PATCH] 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. --- src/basic/path-lookup.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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; -- 2.47.3