aboutsummaryrefslogtreecommitdiffstats
path: root/src/conf.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2004-02-25 21:10:56 +0000
committerWarren Dukes <warren.dukes@gmail.com>2004-02-25 21:10:56 +0000
commit8edc416344afe51e3509d09e11a37c91517e0f6a (patch)
tree87917c82caffb575dad24880bbd00d71ec8fa99a /src/conf.c
parente1c839cd5679f9b60f6b5e2bfd3a341b64463456 (diff)
downloadmpd-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.c7
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]]);