summaryrefslogtreecommitdiffstats
path: root/spawn.c
diff options
context:
space:
mode:
Diffstat (limited to 'spawn.c')
-rw-r--r--spawn.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/spawn.c b/spawn.c
index 7c279eff..b9fe2a2d 100644
--- a/spawn.c
+++ b/spawn.c
@@ -377,10 +377,10 @@ spawn_pane(struct spawn_context *sc, char **cause)
* Child process. Change to the working directory or home if that
* fails.
*/
- if (chdir(new_wp->cwd) != 0) {
- if ((tmp = find_home()) == NULL || chdir(tmp) != 0)
- chdir("/");
- }
+ if (chdir(new_wp->cwd) != 0 &&
+ ((tmp = find_home()) == NULL || chdir(tmp) != 0) &&
+ chdir("/") != 0)
+ fatal("chdir failed");
/*
* Update terminal escape characters from the session if available and