From: David Edmundson Date: Wed, 25 Mar 2020 22:49:35 +0000 (+0000) Subject: path-lookup: Use default value for XDG_CONFIG_DIRS if environment is not set X-Git-Tag: v245.4~14 X-Git-Url: http://git-history.diyao.me/?a=commitdiff_plain;h=e6fcb95f4ae0bb92fe49725370b6e9ed5776a9c8;p=systemd%2F.git 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. (cherry picked from commit f0d0698f0b7d565e6eade043450f7f5557c8db48) --- diff --git a/src/shared/path-lookup.c b/src/shared/path-lookup.c index 5b16209745..48e0eec09a 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)