summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/spawn.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2021-02-19 09:09:16 +0000
committernicm <nicm@openbsd.org>2021-02-19 09:09:16 +0000
commitf93f4929030638a9dfe58b64856c183d41da4fc6 (patch)
tree09a22ef2d986082530aa747f05ad739dce60e02b /usr.bin/tmux/spawn.c
parentMove the mkpath() call from the rsync path to the main process. This allows (diff)
downloadwireguard-openbsd-f93f4929030638a9dfe58b64856c183d41da4fc6.tar.xz
wireguard-openbsd-f93f4929030638a9dfe58b64856c183d41da4fc6.zip
Check return value of chdir() to stop a silly warning with some
compilers, GitHub issue 2573.
Diffstat (limited to 'usr.bin/tmux/spawn.c')
-rw-r--r--usr.bin/tmux/spawn.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/tmux/spawn.c b/usr.bin/tmux/spawn.c
index 57bc0188d30..0865fcf3145 100644
--- a/usr.bin/tmux/spawn.c
+++ b/usr.bin/tmux/spawn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: spawn.c,v 1.24 2020/05/21 07:24:13 nicm Exp $ */
+/* $OpenBSD: spawn.c,v 1.25 2021/02/19 09:09:16 nicm Exp $ */
/*
* Copyright (c) 2019 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -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