diff options
author | Brian Ashworth <bosrsf04@gmail.com> | 2019-02-05 22:06:42 -0500 |
---|---|---|
committer | emersion <contact@emersion.fr> | 2019-02-06 09:36:33 +0100 |
commit | c65057ef8b03ce11d4c002ed8d1615926486b7a4 (patch) | |
tree | 95d37c5347570b9f4f639c3ee092dbbf5995a28b /sway | |
parent | Fix close_popups for xdg-shell (diff) | |
download | sway-c65057ef8b03ce11d4c002ed8d1615926486b7a4.tar.gz sway-c65057ef8b03ce11d4c002ed8d1615926486b7a4.tar.zst sway-c65057ef8b03ce11d4c002ed8d1615926486b7a4.zip |
load_main_config: add realpath to config_chain
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.
Diffstat (limited to 'sway')
-rw-r--r-- | sway/config.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sway/config.c b/sway/config.c index 0c23fad8..18fb69d9 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -379,6 +379,14 @@ bool load_main_config(const char *file, bool is_active, bool validating) { | |||
379 | path = get_config_path(); | 379 | path = get_config_path(); |
380 | } | 380 | } |
381 | 381 | ||
382 | char *real_path = realpath(path, NULL); | ||
383 | if (real_path == NULL) { | ||
384 | sway_log(SWAY_DEBUG, "%s not found.", path); | ||
385 | free(path); | ||
386 | return false; | ||
387 | } | ||
388 | free(path); | ||
389 | |||
382 | struct sway_config *old_config = config; | 390 | struct sway_config *old_config = config; |
383 | config = calloc(1, sizeof(struct sway_config)); | 391 | config = calloc(1, sizeof(struct sway_config)); |
384 | if (!config) { | 392 | if (!config) { |
@@ -401,8 +409,8 @@ bool load_main_config(const char *file, bool is_active, bool validating) { | |||
401 | input_manager_reset_all_inputs(); | 409 | input_manager_reset_all_inputs(); |
402 | } | 410 | } |
403 | 411 | ||
404 | config->current_config_path = path; | 412 | config->current_config_path = real_path; |
405 | list_add(config->config_chain, path); | 413 | list_add(config->config_chain, real_path); |
406 | 414 | ||
407 | config->reading = true; | 415 | config->reading = true; |
408 | 416 | ||
@@ -454,7 +462,7 @@ bool load_main_config(const char *file, bool is_active, bool validating) { | |||
454 | } | 462 | } |
455 | */ | 463 | */ |
456 | 464 | ||
457 | success = success && load_config(path, config, | 465 | success = success && load_config(real_path, config, |
458 | &config->swaynag_config_errors); | 466 | &config->swaynag_config_errors); |
459 | 467 | ||
460 | if (validating) { | 468 | if (validating) { |