diff options
Diffstat (limited to 'src/pulse/client-conf.c')
-rw-r--r-- | src/pulse/client-conf.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/src/pulse/client-conf.c b/src/pulse/client-conf.c index abd277a6..2ead871f 100644 --- a/src/pulse/client-conf.c +++ b/src/pulse/client-conf.c @@ -1,5 +1,3 @@ -/* $Id$ */ - /*** This file is part of PulseAudio. @@ -58,10 +56,10 @@ static const pa_client_conf default_conf = { .default_sink = NULL, .default_source = NULL, .default_server = NULL, - .autospawn = 0, - .disable_shm = 0, + .autospawn = TRUE, + .disable_shm = FALSE, .cookie_file = NULL, - .cookie_valid = 0, + .cookie_valid = FALSE, }; pa_client_conf *pa_client_conf_new(void) { @@ -112,13 +110,20 @@ int pa_client_conf_load(pa_client_conf *c, const char *filename) { table[6].data = &c->cookie_file; table[7].data = &c->disable_shm; - f = filename ? - fopen((fn = pa_xstrdup(filename)), "r") : - pa_open_config_file(DEFAULT_CLIENT_CONFIG_FILE, DEFAULT_CLIENT_CONFIG_FILE_USER, ENV_CLIENT_CONFIG_FILE, &fn, "r"); + if (filename) { + + if (!(f = fopen(filename, "r"))) { + pa_log("Failed to open configuration file '%s': %s", fn, pa_cstrerror(errno)); + goto finish; + } + + fn = pa_xstrdup(fn); + + } else { - if (!f && errno != EINTR) { - pa_log_warn("Failed to open configuration file '%s': %s", fn, pa_cstrerror(errno)); - goto finish; + if (!(f = pa_open_config_file(DEFAULT_CLIENT_CONFIG_FILE, DEFAULT_CLIENT_CONFIG_FILE_USER, ENV_CLIENT_CONFIG_FILE, &fn))) + if (errno != ENOENT) + goto finish; } r = f ? pa_config_parse(fn, f, table, NULL) : 0; @@ -126,7 +131,6 @@ int pa_client_conf_load(pa_client_conf *c, const char *filename) { if (!r) r = pa_client_conf_load_cookie(c); - finish: pa_xfree(fn); @@ -172,15 +176,14 @@ int pa_client_conf_env(pa_client_conf *c) { int pa_client_conf_load_cookie(pa_client_conf* c) { pa_assert(c); - c->cookie_valid = 0; - if (!c->cookie_file) return -1; + c->cookie_valid = FALSE; + if (pa_authkey_load_auto(c->cookie_file, c->cookie, sizeof(c->cookie)) < 0) return -1; - c->cookie_valid = 1; + c->cookie_valid = TRUE; return 0; } - |