mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-03 09:01:50 -05:00
client-conf: Don't create multiple cookie files
The old code loaded cookies at the time of loading the client configuration, which could lead to creation of multiple cookie files. For example, when pa_client_conf_load() was called, the default cookie file was created, and then if PULSE_COOKIE was set, pa_client_conf_env() would create another cookie file. This patch moves the loading of the cookie to a separate function, which pa_context calls just before needing the cookie, so the cookie won't be loaded from the default file if PULSE_COOKIE is set. This patch also splits the single cookie and cookie_file fields in pa_client_conf into multiple fields, one for each possible cookie source. That change allows falling back to another cookie source if the primary source doesn't work. BugLink: https://bugs.freedesktop.org/show_bug.cgi?id=75006
This commit is contained in:
parent
0a583fe0c3
commit
1116daa5eb
4 changed files with 104 additions and 88 deletions
|
|
@ -92,10 +92,12 @@ int pa_client_conf_from_x11(pa_client_conf *c) {
|
|||
}
|
||||
|
||||
if (pa_x11_get_prop(xcb, screen, "PULSE_COOKIE", t, sizeof(t))) {
|
||||
if (pa_client_conf_load_cookie_from_hex(c, t) < 0) {
|
||||
if (pa_parsehex(t, c->cookie_from_x11, sizeof(c->cookie_from_x11)) != sizeof(c->cookie_from_x11)) {
|
||||
pa_log(_("Failed to parse cookie data"));
|
||||
goto finish;
|
||||
}
|
||||
|
||||
c->cookie_from_x11_valid = true;
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue