aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-02-05 22:06:42 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2019-02-11 10:22:53 -0500
commitd2d2fc545ac706683a2da0118ec1c4842ed87d7f (patch)
tree95d37c5347570b9f4f639c3ee092dbbf5995a28b
parentFix close_popups for xdg-shell (diff)
downloadsway-d2d2fc545ac706683a2da0118ec1c4842ed87d7f.tar.gz
sway-d2d2fc545ac706683a2da0118ec1c4842ed87d7f.tar.zst
sway-d2d2fc545ac706683a2da0118ec1c4842ed87d7f.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.
-rw-r--r--sway/config.c14
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) {