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:
Pierre Ossman 2006-01-10 16:56:59 +00:00
parent 29118f50cb
commit 34e81ffb35

View file

@ -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) {
assert(fn && s && l > 0);
#ifndef OS_IS_WIN32
if (fn[0] != '/') {
#else
if (strlen(fn) < 3 || !isalpha(fn[0]) || fn[1] != ':' || fn[2] != '\\') {
#endif
char homedir[PATH_MAX];
if (!pa_get_home_dir(homedir, sizeof(homedir)))
return NULL;
#ifndef OS_IS_WIN32
snprintf(s, l, "%s/%s", homedir, fn);
#else
snprintf(s, l, "%s\\%s", homedir, fn);
#endif
return s;
}