mirror of
https://github.com/yshui/picom.git
synced 2024-11-25 14:06:08 -05:00
config_libconfig: resolve symlinks when setting include dir
If the config file is loaded from a symlink'd locaiton, it could be confusing that include dir is set based on the location of the symlink instead of the real file. Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
parent
e2ed9125ed
commit
a8b15f3a1b
1 changed files with 5 additions and 6 deletions
|
@ -334,15 +334,14 @@ char *parse_config_libconfig(options_t *opt, const char *config_file, bool *shad
|
|||
config_set_options(&cfg, CONFIG_OPTION_ALLOW_OVERRIDES);
|
||||
#endif
|
||||
{
|
||||
// dirname() could modify the original string, thus we must pass a
|
||||
// copy
|
||||
char *path2 = strdup(path);
|
||||
char *parent = dirname(path2);
|
||||
char *abspath = realpath(path, NULL);
|
||||
char *parent = dirname(abspath); // path2 may be modified
|
||||
|
||||
if (parent)
|
||||
if (parent) {
|
||||
config_set_include_dir(&cfg, parent);
|
||||
}
|
||||
|
||||
free(path2);
|
||||
free(abspath);
|
||||
}
|
||||
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue