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 /sway | |
parent | Clarify error for options and positional args (diff) | |
download | sway-8229814e7a8122b022e5f92fb4d925b00d0d4b1c.tar.gz sway-8229814e7a8122b022e5f92fb4d925b00d0d4b1c.tar.zst sway-8229814e7a8122b022e5f92fb4d925b00d0d4b1c.zip |
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.
Diffstat (limited to 'sway')
-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 18fb69d9..ae8d11e3 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) { | |||
385 | free(path); | 385 | free(path); |
386 | return false; | 386 | return false; |
387 | } | 387 | } |
388 | free(path); | ||
389 | 388 | ||
390 | struct sway_config *old_config = config; | 389 | struct sway_config *old_config = config; |
391 | config = calloc(1, sizeof(struct sway_config)); | 390 | config = calloc(1, sizeof(struct sway_config)); |
@@ -409,7 +408,7 @@ bool load_main_config(const char *file, bool is_active, bool validating) { | |||
409 | input_manager_reset_all_inputs(); | 408 | input_manager_reset_all_inputs(); |
410 | } | 409 | } |
411 | 410 | ||
412 | config->current_config_path = real_path; | 411 | config->current_config_path = path; |
413 | list_add(config->config_chain, real_path); | 412 | list_add(config->config_chain, real_path); |
414 | 413 | ||
415 | config->reading = true; | 414 | config->reading = true; |
@@ -462,7 +461,7 @@ bool load_main_config(const char *file, bool is_active, bool validating) { | |||
462 | } | 461 | } |
463 | */ | 462 | */ |
464 | 463 | ||
465 | success = success && load_config(real_path, config, | 464 | success = success && load_config(path, config, |
466 | &config->swaynag_config_errors); | 465 | &config->swaynag_config_errors); |
467 | 466 | ||
468 | if (validating) { | 467 | if (validating) { |