summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2012-05-15 23:25:00 +0200
committerLennart Poettering <lennart@poettering.net>2012-05-15 23:25:00 +0200
commit9ab510a69216b468c80acad92a0e2360ffccfea2 (patch)
tree7d03c9f7a6e4ea3560fe65ac3979a5880a7895ef
parent4bc865ad6ea8e566cc95f6abb39d1028d9c652a1 (diff)
core-util: when searching for configuration files, honour XDG basedir spec
-rw-r--r--src/pulsecore/core-util.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/pulsecore/core-util.c b/src/pulsecore/core-util.c
index e6c21bea..82480c66 100644
--- a/src/pulsecore/core-util.c
+++ b/src/pulsecore/core-util.c
@@ -1792,15 +1792,22 @@ FILE *pa_open_config_file(const char *global, const char *local, const char *env
char *lfn;
char *h;
- if ((e = getenv("PULSE_CONFIG_PATH")))
+ if ((e = getenv("PULSE_CONFIG_PATH"))) {
fn = lfn = pa_sprintf_malloc("%s" PA_PATH_SEP "%s", e, local);
- else if ((h = pa_get_home_dir_malloc())) {
+ f = pa_fopen_cloexec(fn, "r");
+ } else if ((h = pa_get_home_dir_malloc())) {
fn = lfn = pa_sprintf_malloc("%s" PA_PATH_SEP ".pulse" PA_PATH_SEP "%s", h, local);
+ f = pa_fopen_cloexec(fn, "r");
+ if (!f) {
+ free(lfn);
+ fn = lfn = pa_sprintf_malloc("%s" PA_PATH_SEP ".config/pulse" PA_PATH_SEP "%s", h, local);
+ f = pa_fopen_cloexec(fn, "r");
+ }
pa_xfree(h);
} else
return NULL;
- if ((f = pa_fopen_cloexec(fn, "r"))) {
+ if (f) {
if (result)
*result = pa_xstrdup(fn);