summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2021-02-19 10:01:19 +0000
committerThomas Adam <thomas@xteddy.org>2021-02-19 10:01:19 +0000
commit742e67080586e212f3c6adbdc1c59bf56b0712b1 (patch)
treec5cb12542b0218f3fc94bf04b77f393fcad631a5
parent11e404ca3c80893f59b1001f000c9390216c7e7a (diff)
parentb04f8acb7057bda74e30976acedbbd73767e5bdc (diff)
Merge branch 'obsd-master' into master
-rw-r--r--job.c8
-rw-r--r--spawn.c8
2 files changed, 8 insertions, 8 deletions
diff --git a/job.c b/job.c
index 6c1a3e09..5bf53a76 100644
--- a/job.c
+++ b/job.c
@@ -112,10 +112,10 @@ job_run(const char *cmd, struct session *s, const char *cwd,
proc_clear_signals(server_proc, 1);
sigprocmask(SIG_SETMASK, &oldset, NULL);
- if (cwd == NULL || chdir(cwd) != 0) {
- if ((home = find_home()) == NULL || chdir(home) != 0)
- chdir("/");
- }
+ if ((cwd == NULL || chdir(cwd) != 0) &&
+ ((home = find_home()) == NULL || chdir(home) != 0) &&
+ chdir("/") != 0)
+ fatal("chdir failed");
environ_push(env);
environ_free(env);
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