From 385cf330aebe9d9996076912e8b826efeb365627 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 7 Feb 2019 21:22:53 -0500 Subject: [PATCH 1/2] Revert "Restore CWD if returning early." This reverts commit 921e42c6c06212a61d899d6335d95eb4c781e2e8. --- sway/config.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/sway/config.c b/sway/config.c index 0c791a35d..18df2add2 100644 --- a/sway/config.c +++ b/sway/config.c @@ -557,13 +557,17 @@ bool load_include_configs(const char *path, struct sway_config *config, const char *parent_dir = dirname(parent_path); if (chdir(parent_dir) < 0) { - goto error_chdir; + free(parent_path); + free(wd); + return false; } wordexp_t p; if (wordexp(path, &p, 0) != 0) { - goto error_wordexp; + free(parent_path); + free(wd); + return false; } char **w = p.we_wordv; @@ -571,7 +575,10 @@ bool load_include_configs(const char *path, struct sway_config *config, for (i = 0; i < p.we_wordc; ++i) { bool found = load_include_config(w[i], parent_dir, config, swaynag); if (!found) { - goto error_not_found; + wordfree(&p); + free(parent_path); + free(wd); + return false; } } free(parent_path); @@ -586,16 +593,6 @@ bool load_include_configs(const char *path, struct sway_config *config, free(wd); return true; -error_not_found: - wordfree(&p); -error_wordexp: - if (chdir(wd) < 0) { - sway_log(SWAY_ERROR, "failed to restore working directory"); - } -error_chdir: - free(parent_path); - free(wd); - return false; } void run_deferred_commands(void) { From 82d7a70b03b43e8e417aeb84803ef04f452bce13 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Thu, 7 Feb 2019 21:22:53 -0500 Subject: [PATCH 2/2] Revert "Return false if config could not be loaded." This reverts commit 855368b67e8b7d0b1dd035bde7f9119d37b35e5d. --- sway/config.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/sway/config.c b/sway/config.c index 18df2add2..ae8d11e35 100644 --- a/sway/config.c +++ b/sway/config.c @@ -573,13 +573,7 @@ bool load_include_configs(const char *path, struct sway_config *config, char **w = p.we_wordv; size_t i; for (i = 0; i < p.we_wordc; ++i) { - bool found = load_include_config(w[i], parent_dir, config, swaynag); - if (!found) { - wordfree(&p); - free(parent_path); - free(wd); - return false; - } + load_include_config(w[i], parent_dir, config, swaynag); } free(parent_path); wordfree(&p);