mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
Handle Windows paths when normalizing authkey path.
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/ossman@444 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
29118f50cb
commit
34e81ffb35
1 changed files with 8 additions and 0 deletions
|
|
@ -128,12 +128,20 @@ int pa_authkey_load(const char *path, void *data, size_t length) {
|
||||||
static const char *normalize_path(const char *fn, char *s, size_t l) {
|
static const char *normalize_path(const char *fn, char *s, size_t l) {
|
||||||
assert(fn && s && l > 0);
|
assert(fn && s && l > 0);
|
||||||
|
|
||||||
|
#ifndef OS_IS_WIN32
|
||||||
if (fn[0] != '/') {
|
if (fn[0] != '/') {
|
||||||
|
#else
|
||||||
|
if (strlen(fn) < 3 || !isalpha(fn[0]) || fn[1] != ':' || fn[2] != '\\') {
|
||||||
|
#endif
|
||||||
char homedir[PATH_MAX];
|
char homedir[PATH_MAX];
|
||||||
if (!pa_get_home_dir(homedir, sizeof(homedir)))
|
if (!pa_get_home_dir(homedir, sizeof(homedir)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
#ifndef OS_IS_WIN32
|
||||||
snprintf(s, l, "%s/%s", homedir, fn);
|
snprintf(s, l, "%s/%s", homedir, fn);
|
||||||
|
#else
|
||||||
|
snprintf(s, l, "%s\\%s", homedir, fn);
|
||||||
|
#endif
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue