aboutsummaryrefslogtreecommitdiff
path: root/config.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2022-04-06 18:54:04 +0000
committerDaniel Eklöf <daniel@ekloef.se>2022-04-07 11:06:01 +0000
commitc7dd30742ab412fc0194eebbc5e081527772fdaf (patch)
tree5d026402991ed32724b16e41027d4f0a93552a42 /config.c
parentconfig: fallback to /etc/xdg if XDG_CONFIG_DIRS is unset (diff)
config: use fallback when XDG_CONFIG_{HOME,DIRS} is set, but empty
Diffstat (limited to 'config.c')
-rw-r--r--config.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/config.c b/config.c
index d7bdc8d8..381b9342 100644
--- a/config.c
+++ b/config.c
@@ -414,7 +414,7 @@ open_config(void)
char *xdg_config_dirs_copy = NULL;
/* Use XDG_CONFIG_HOME, or ~/.config */
- if (xdg_config_home != NULL) {
+ if (xdg_config_home != NULL && xdg_config_home[0] != '\0') {
int fd = open(xdg_config_home, O_RDONLY);
if (fd >= 0)
path_component_add(&components, xdg_config_home, fd);
@@ -447,7 +447,7 @@ open_config(void)
/* Finally, try foot/foot.ini in all XDG_CONFIG_DIRS, or /etc/xdg
* if unset */
const char *xdg_config_dirs = getenv("XDG_CONFIG_DIRS");
- xdg_config_dirs_copy = xdg_config_dirs != NULL
+ xdg_config_dirs_copy = xdg_config_dirs != NULL && xdg_config_dirs[0] != '\0'
? strdup(xdg_config_dirs)
: strdup("/etc/xdg");