diff options
author | Drew DeVault <sir@cmpwn.com> | 2019-02-07 21:22:53 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-07 21:22:53 -0500 |
commit | 385cf330aebe9d9996076912e8b826efeb365627 (patch) | |
tree | c76c0f0993361c0ef6668d84a4094ad3bfa525ef /sway | |
parent | seat_configure_tablet_tool: configure xcursor (diff) | |
download | sway-385cf330aebe9d9996076912e8b826efeb365627.tar.gz sway-385cf330aebe9d9996076912e8b826efeb365627.tar.zst sway-385cf330aebe9d9996076912e8b826efeb365627.zip |
Revert "Restore CWD if returning early."
This reverts commit 921e42c6c06212a61d899d6335d95eb4c781e2e8.
Diffstat (limited to 'sway')
-rw-r--r-- | sway/config.c | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/sway/config.c b/sway/config.c index 0c791a35..18df2add 100644 --- a/sway/config.c +++ b/sway/config.c | |||
@@ -557,13 +557,17 @@ bool load_include_configs(const char *path, struct sway_config *config, | |||
557 | const char *parent_dir = dirname(parent_path); | 557 | const char *parent_dir = dirname(parent_path); |
558 | 558 | ||
559 | if (chdir(parent_dir) < 0) { | 559 | if (chdir(parent_dir) < 0) { |
560 | goto error_chdir; | 560 | free(parent_path); |
561 | free(wd); | ||
562 | return false; | ||
561 | } | 563 | } |
562 | 564 | ||
563 | wordexp_t p; | 565 | wordexp_t p; |
564 | 566 | ||
565 | if (wordexp(path, &p, 0) != 0) { | 567 | if (wordexp(path, &p, 0) != 0) { |
566 | goto error_wordexp; | 568 | free(parent_path); |
569 | free(wd); | ||
570 | return false; | ||
567 | } | 571 | } |
568 | 572 | ||
569 | char **w = p.we_wordv; | 573 | char **w = p.we_wordv; |
@@ -571,7 +575,10 @@ bool load_include_configs(const char *path, struct sway_config *config, | |||
571 | for (i = 0; i < p.we_wordc; ++i) { | 575 | for (i = 0; i < p.we_wordc; ++i) { |
572 | bool found = load_include_config(w[i], parent_dir, config, swaynag); | 576 | bool found = load_include_config(w[i], parent_dir, config, swaynag); |
573 | if (!found) { | 577 | if (!found) { |
574 | goto error_not_found; | 578 | wordfree(&p); |
579 | free(parent_path); | ||
580 | free(wd); | ||
581 | return false; | ||
575 | } | 582 | } |
576 | } | 583 | } |
577 | free(parent_path); | 584 | free(parent_path); |
@@ -586,16 +593,6 @@ bool load_include_configs(const char *path, struct sway_config *config, | |||
586 | 593 | ||
587 | free(wd); | 594 | free(wd); |
588 | return true; | 595 | return true; |
589 | error_not_found: | ||
590 | wordfree(&p); | ||
591 | error_wordexp: | ||
592 | if (chdir(wd) < 0) { | ||
593 | sway_log(SWAY_ERROR, "failed to restore working directory"); | ||
594 | } | ||
595 | error_chdir: | ||
596 | free(parent_path); | ||
597 | free(wd); | ||
598 | return false; | ||
599 | } | 596 | } |
600 | 597 | ||
601 | void run_deferred_commands(void) { | 598 | void run_deferred_commands(void) { |