Recovering tilde expansion from config files. Thanks to Juha Erkkilä for reporting and investigating. wordexp() code copied and adapted from old Bill's code.
This commit is contained in:
parent
b0f9edcc8e
commit
c692eca118
1 changed files with 13 additions and 0 deletions
|
|
@ -21623,11 +21623,24 @@ static void parse_file_options(struct cfginfo *restrict tmpcfg, const char *file
|
||||||
arg = strchr(str,'=');
|
arg = strchr(str,'=');
|
||||||
if(arg)
|
if(arg)
|
||||||
*arg++ = '\0';
|
*arg++ = '\0';
|
||||||
|
|
||||||
|
#ifdef __linux__
|
||||||
|
/* Perform shell expansion */
|
||||||
|
wordexp_t result;
|
||||||
|
|
||||||
|
wordexp(arg, &result, 0);
|
||||||
|
arg = strdup(result.we_wordv[0]);
|
||||||
|
wordfree(&result);
|
||||||
|
#endif
|
||||||
|
|
||||||
// FIXME: leaking mem here, but the trouble is that these
|
// FIXME: leaking mem here, but the trouble is that these
|
||||||
// strings get mixed in with ones from .data and .rodata
|
// strings get mixed in with ones from .data and .rodata
|
||||||
// and free() isn't smart about the situation -- also some
|
// and free() isn't smart about the situation -- also some
|
||||||
// of the strings end up being kept around
|
// of the strings end up being kept around
|
||||||
parse_one_option(tmpcfg,str,strdup(arg),filename);
|
parse_one_option(tmpcfg,str,strdup(arg),filename);
|
||||||
|
#ifdef __linux__
|
||||||
|
free(arg);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
fclose(fi);
|
fclose(fi);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue