Commit 3706edb4 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

posix: handle non-NULL filename with environment-based directories

parent a4673110
......@@ -57,8 +57,14 @@ char *config_GetSysPath(vlc_sysdir_t type, const char *filename)
const char *name = env_vars[type];
if (*name != '\0') {
const char *value = getenv(name);
if (value != NULL)
return strdup(value);
if (value != NULL) {
const char *fmt = (filename != NULL) ? "%s/%s" : "%s";
char *filepath;
if (unlikely(asprintf(&filepath, fmt, value, filename) == -1))
filepath = NULL;
return filepath;
}
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment