diff options
author | Warren Dukes <warren.dukes@gmail.com> | 2004-02-25 21:10:56 +0000 |
---|---|---|
committer | Warren Dukes <warren.dukes@gmail.com> | 2004-02-25 21:10:56 +0000 |
commit | 8edc416344afe51e3509d09e11a37c91517e0f6a (patch) | |
tree | 87917c82caffb575dad24880bbd00d71ec8fa99a /src/conf.c | |
parent | e1c839cd5679f9b60f6b5e2bfd3a341b64463456 (diff) | |
download | mpd-8edc416344afe51e3509d09e11a37c91517e0f6a.tar.gz mpd-8edc416344afe51e3509d09e11a37c91517e0f6a.tar.xz mpd-8edc416344afe51e3509d09e11a37c91517e0f6a.zip |
some more cleanups
git-svn-id: https://svn.musicpd.org/mpd/trunk@60 09075e82-0dd4-0310-85a5-a0d7c8717e4f
Diffstat (limited to 'src/conf.c')
-rw-r--r-- | src/conf.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/conf.c b/src/conf.c index 889a0086b..b6d03b030 100644 --- a/src/conf.c +++ b/src/conf.c @@ -216,13 +216,16 @@ char ** readConf(char * file) { conf_params[conf_absolutePaths[i]]); exit(-1); } + /* Parse ~ in path */ else if(conf_params[conf_absolutePaths[i]] && conf_params[conf_absolutePaths[i]][0]=='~') { struct passwd * pwd = NULL; char * path; int pos = 1; - if(conf_params[conf_absolutePaths[i]][1]=='/') { + if(conf_params[conf_absolutePaths[i]][1]=='/' || + conf_params[conf_absolutePaths[i]][1]=='\0') + { uid_t uid = geteuid(); if((pwd = getpwuid(uid)) == NULL) { ERROR("problems getting passwd entry " @@ -251,7 +254,7 @@ char ** readConf(char * file) { if(foundSlash) *ch = '/'; } path = malloc(strlen(pwd->pw_dir)+strlen( - &(conf_params[conf_absolutePaths[i]][pos]))); + &(conf_params[conf_absolutePaths[i]][pos]))+1); strcpy(path,pwd->pw_dir); strcat(path,&(conf_params[conf_absolutePaths[i]][pos])); free(conf_params[conf_absolutePaths[i]]); |