From b04f8acb7057bda74e30976acedbbd73767e5bdc Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 19 Feb 2021 09:09:16 +0000 Subject: Check return value of chdir() to stop a silly warning with some compilers, GitHub issue 2573. --- spawn.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'spawn.c') 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 -- cgit