summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Edmundson <davidedmundson@kde.org>2020-03-25 22:49:35 +0000
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2020-03-26 18:25:41 +0100
commitf0d0698f0b7d565e6eade043450f7f5557c8db48 (patch)
tree4b02ba2324f9e5cf7e66f54c59e3caf4973f7abc /src
parenta879b6d22f17495481b2dc5de64a9cd5601ad121 (diff)
downloadsystemd-f0d0698f0b7d565e6eade043450f7f5557c8db48.tar.gz
path-lookup: Use default value for XDG_CONFIG_DIRS if environment is not set
If XDG_CONFIG_DIRS is unset, the specification says we should assume /etc/xdg.
Diffstat (limited to 'src')
-rw-r--r--src/shared/path-lookup.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c
index 20d6c03a9a..2707dce7a8 100644
--- a/src/shared/path-lookup.c
+++ b/src/shared/path-lookup.c
@@ -125,11 +125,12 @@ int xdg_user_dirs(char ***ret_config_dirs, char ***ret_data_dirs) {
_cleanup_strv_free_ char **config_dirs = NULL, **data_dirs = NULL;
e = getenv("XDG_CONFIG_DIRS");
- if (e) {
+ if (e)
config_dirs = strv_split(e, ":");
- if (!config_dirs)
- return -ENOMEM;
- }
+ else
+ config_dirs = strv_new("/etc/xdg");
+ if (!config_dirs)
+ return -ENOMEM;
e = getenv("XDG_DATA_DIRS");
if (e)