aboutsummaryrefslogtreecommitdiff
path: root/spawn.c
diff options
context:
space:
mode:
authornicm <nicm>2021-02-19 09:09:16 +0000
committernicm <nicm>2021-02-19 09:09:16 +0000
commitb04f8acb7057bda74e30976acedbbd73767e5bdc (patch)
tree8b3be4d6a36b2dcc2fb668a510f94f4d3a1ec1d0 /spawn.c
parentfb42ae3071763fdc6a2fe2e57feec774623b1c33 (diff)
downloadrtmux-b04f8acb7057bda74e30976acedbbd73767e5bdc.tar.gz
rtmux-b04f8acb7057bda74e30976acedbbd73767e5bdc.tar.bz2
rtmux-b04f8acb7057bda74e30976acedbbd73767e5bdc.zip
Check return value of chdir() to stop a silly warning with some
compilers, GitHub issue 2573.
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 d5b52ffa..41ffe612 100644
--- a/spawn.c
+++ b/spawn.c
@@ -379,10 +379,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