]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
path-lookup: Use default value for XDG_CONFIG_DIRS if environment is not set
authorDavid Edmundson <davidedmundson@kde.org>
Wed, 25 Mar 2020 22:49:35 +0000 (22:49 +0000)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 26 Mar 2020 17:25:41 +0000 (18:25 +0100)
If XDG_CONFIG_DIRS is unset, the specification says we should assume
/etc/xdg.

src/shared/path-lookup.c

index 20d6c03a9ad40a4bec31f7a99501dc845d04a519..2707dce7a83a0a748252b51762360669aa9fc63a 100644 (file)
@@ -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)