aboutsummaryrefslogtreecommitdiffstats
path: root/src/conf.c
diff options
context:
space:
mode:
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]]);