diff options
author | Warren Dukes <warren.dukes@gmail.com> | 2005-03-06 20:04:50 +0000 |
---|---|---|
committer | Warren Dukes <warren.dukes@gmail.com> | 2005-03-06 20:04:50 +0000 |
commit | 32a1f952e85d5c8f2f2c19dffecc05b4ee8364b2 (patch) | |
tree | a4218fc0e38db99bed5cfe9108d4a4c2fcdb8e93 /src/path.c | |
parent | 522bb6b61fcad9e752f45bf689755cc265e6502c (diff) | |
download | mpd-32a1f952e85d5c8f2f2c19dffecc05b4ee8364b2.tar.gz mpd-32a1f952e85d5c8f2f2c19dffecc05b4ee8364b2.tar.xz mpd-32a1f952e85d5c8f2f2c19dffecc05b4ee8364b2.zip |
fix stateFile path getting garbled
git-svn-id: https://svn.musicpd.org/mpd/trunk@3029 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/path.c')
-rw-r--r-- | src/path.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/path.c b/src/path.c index c35be7f04..dec9844b6 100644 --- a/src/path.c +++ b/src/path.c @@ -116,15 +116,15 @@ static char * appendSlash(char ** path) { int len = strlen(temp); if(temp[len-1] != '/') { - temp = strdup(*path); + temp = malloc(len+2); + memset(temp, 0, len+2); + memcpy(temp, *path, len); + temp[len] = '/'; free(*path); - *path = malloc(len+2); - memset(*path, 0, len+2); - memcpy(*path, temp, len); - (*path)[len] = '/'; + *path = temp; } - return * path; + return temp; } void initPaths() { @@ -136,8 +136,8 @@ void initPaths() { char * originalLocale; DIR * dir; - musicDir = appendSlash(&musicParam->value); - playlistDir = appendSlash(&playlistParam->value); + musicDir = appendSlash(&(musicParam->value)); + playlistDir = appendSlash(&(playlistParam->value)); if((dir = opendir(playlistDir)) == NULL) { ERROR("cannot open %s \"%s\" (config line %i): %s\n", |