mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-05 13:29:57 -05:00
esound, native: Pass an absolute path to pa_authkey_load() when using a file in the home directory
If a relative path is passed to pa_authkey_load(), it will interpret the path as relative to the home directory. This is wrong, because relative paths should be interpreted to be relative to the config home directory. Before fixing pa_authkey_load(), this patch prepares for the change by using absolute paths when the file actually needs to be in the home directory (i.e. the fallback cookie path for the native protocol and the default cookie path for the esound protocol).
This commit is contained in:
parent
50042da434
commit
14845b2c8e
4 changed files with 35 additions and 10 deletions
|
|
@ -168,6 +168,7 @@ void pa_client_conf_load(pa_client_conf *c, bool load_from_x11, bool load_from_e
|
|||
|
||||
int pa_client_conf_load_cookie(pa_client_conf *c, uint8_t *cookie, size_t cookie_length) {
|
||||
int r;
|
||||
char *fallback_path;
|
||||
|
||||
pa_assert(c);
|
||||
pa_assert(cookie);
|
||||
|
|
@ -213,9 +214,12 @@ int pa_client_conf_load_cookie(pa_client_conf *c, uint8_t *cookie, size_t cookie
|
|||
if (r >= 0)
|
||||
return 0;
|
||||
|
||||
r = pa_authkey_load(PA_NATIVE_COOKIE_FILE_FALLBACK, false, cookie, cookie_length);
|
||||
if (r >= 0)
|
||||
return 0;
|
||||
if (pa_append_to_home_dir(PA_NATIVE_COOKIE_FILE_FALLBACK, &fallback_path) > 0) {
|
||||
r = pa_authkey_load(fallback_path, false, cookie, cookie_length);
|
||||
pa_xfree(fallback_path);
|
||||
if (r >= 0)
|
||||
return 0;
|
||||
}
|
||||
|
||||
r = pa_authkey_load(PA_NATIVE_COOKIE_FILE, true, cookie, cookie_length);
|
||||
if (r >= 0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue