diff options
author | Brian Ashworth <bosrsf04@gmail.com> | 2019-02-07 02:16:38 -0500 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2019-02-11 10:22:53 -0500 |
commit | 8229814e7a8122b022e5f92fb4d925b00d0d4b1c (patch) | |
tree | a75a0501eb55dcb4f2ef7c18f76f3721000e07c7 | |
parent | a2f661dceb5baa20bd5d329fbb6fb2d75a4a09f8 (diff) | |
download | sway-8229814e7a8122b022e5f92fb4d925b00d0d4b1c.zip sway-8229814e7a8122b022e5f92fb4d925b00d0d4b1c.tar.gz sway-8229814e7a8122b022e5f92fb4d925b00d0d4b1c.tar.bz2 |
load_main_config: use given path, store realpath
Since `load_include_config` compares against the realpath of a config
file when checking if a config has already been added, the main config's
realpath has to be added to the config_chain.
However, includes from the main config should be processed relative to
the path given to allow for symbolic links. This stores the realpath in
`config->config_chain`, but uses the given path for all other
operations.
-rw-r--r-- | sway/config.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/sway/config.c b/sway/config.c index 18fb69d..ae8d11e 100644 --- a/sway/config.c +++ b/sway/config.c @@ -385,7 +385,6 @@ bool load_main_config(const char *file, bool is_active, bool validating) { free(path); return false; } - free(path); struct sway_config *old_config = config; config = calloc(1, sizeof(struct sway_config)); @@ -409,7 +408,7 @@ bool load_main_config(const char *file, bool is_active, bool validating) { input_manager_reset_all_inputs(); } - config->current_config_path = real_path; + config->current_config_path = path; list_add(config->config_chain, real_path); config->reading = true; @@ -462,7 +461,7 @@ bool load_main_config(const char *file, bool is_active, bool validating) { } */ - success = success && load_config(real_path, config, + success = success && load_config(path, config, &config->swaynag_config_errors); if (validating) { |