summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2021-09-26 08:59:57 +0200
committerPřemysl Eric Janouch <p@janouch.name>2021-09-26 08:59:57 +0200
commit8a6bb54eb5167c211fec3634b6ed9847b80677b6 (patch)
tree1e77135958be196fba054a187ee1b5a9857a010a
parent4ef7c9edf7e37c41712520a1b4acf3b490094629 (diff)
downloadsdn-8a6bb54eb5167c211fec3634b6ed9847b80677b6.tar.gz
sdn-8a6bb54eb5167c211fec3634b6ed9847b80677b6.tar.xz
sdn-8a6bb54eb5167c211fec3634b6ed9847b80677b6.zip
Ignore empty XDG_CONFIG_DIRS
As the specification says we should. GLib does this as well. It is still possible to achieve an empty set by using ":", which are two non-absolute paths that should be ignored. GLib doesn't implement this. Thus, we're now better than GLib.
-rw-r--r--sdn.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/sdn.cpp b/sdn.cpp
index ddcb342..3c4a407 100644
--- a/sdn.cpp
+++ b/sdn.cpp
@@ -268,7 +268,7 @@ fun xdg_config_home () -> string {
fun xdg_config_find (const string &suffix) -> unique_ptr<ifstream> {
vector<string> dirs {xdg_config_home ()};
const char *system_dirs = getenv ("XDG_CONFIG_DIRS");
- split (system_dirs ? system_dirs : "/etc/xdg", ":", dirs);
+ split ((system_dirs && *system_dirs) ? system_dirs : "/etc/xdg", ":", dirs);
for (const auto &dir : dirs) {
if (dir[0] != '/')
continue;