=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/tmux/spawn.c,v retrieving revision 1.24 retrieving revision 1.25 diff -u -r1.24 -r1.25 --- src/usr.bin/tmux/spawn.c 2020/05/21 07:24:13 1.24 +++ src/usr.bin/tmux/spawn.c 2021/02/19 09:09:16 1.25 @@ -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 @@ -379,10 +379,10 @@ * 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