diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2016-03-15 00:55:08 -0400 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2016-03-15 00:55:08 -0400 |
commit | b862a5425553f426e6492bdedbbedc8fbdad98df (patch) | |
tree | 197605dfd14159e4f05df93d772ef649cfea4e48 /src | |
parent | 23a5000b44976005fb14305ed76521724ff15a00 (diff) | |
parent | b6b0cfaafd5dd9685e636c9b46346ee8de68d68c (diff) |
Merge pull request #2840 from linkmauve/use-xdg-config-home
sd-path: use XDG_CONFIG_HOME instead of hardcoding ~/.config for user-dirs
Diffstat (limited to 'src')
-rw-r--r-- | src/libsystemd/sd-path/sd-path.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libsystemd/sd-path/sd-path.c b/src/libsystemd/sd-path/sd-path.c index 480f1ad065..b7aec1f20a 100644 --- a/src/libsystemd/sd-path/sd-path.c +++ b/src/libsystemd/sd-path/sd-path.c @@ -89,7 +89,8 @@ static int from_home_dir(const char *envname, const char *suffix, char **buffer, static int from_user_dir(const char *field, char **buffer, const char **ret) { _cleanup_fclose_ FILE *f = NULL; _cleanup_free_ char *b = NULL; - const char *fn = NULL; + _cleanup_free_ const char *fn = NULL; + const char *c = NULL; char line[LINE_MAX]; size_t n; int r; @@ -98,10 +99,14 @@ static int from_user_dir(const char *field, char **buffer, const char **ret) { assert(buffer); assert(ret); - r = from_home_dir(NULL, ".config/user-dirs.dirs", &b, &fn); + r = from_home_dir("XDG_CONFIG_HOME", ".config", &b, &c); if (r < 0) return r; + fn = strappend(c, "/user-dirs.dirs"); + if (!fn) + return -ENOMEM; + f = fopen(fn, "re"); if (!f) { if (errno == ENOENT) |