summaryrefslogtreecommitdiff
path: root/src/shared/path-lookup.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/path-lookup.c')
-rw-r--r--src/shared/path-lookup.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c
index fa4995ceea..ffdc5367cb 100644
--- a/src/shared/path-lookup.c
+++ b/src/shared/path-lookup.c
@@ -41,21 +41,26 @@ DEFINE_STRING_TABLE_LOOKUP(systemd_running_as, SystemdRunningAs);
int user_config_home(char **config_home) {
const char *e;
+ char *r;
e = getenv("XDG_CONFIG_HOME");
if (e) {
- if (asprintf(config_home, "%s/systemd/user", e) < 0)
+ r = strappend(e, "/systemd/user");
+ if (!r)
return -ENOMEM;
+ *config_home = r;
return 1;
} else {
const char *home;
home = getenv("HOME");
if (home) {
- if (asprintf(config_home, "%s/.config/systemd/user", home) < 0)
+ r = strappend(home, "/.config/systemd/user");
+ if (!r)
return -ENOMEM;
+ *config_home = r;
return 1;
}
}