-/* $OpenBSD: job.c,v 1.58 2020/05/16 15:24:28 nicm Exp $ */
+/* $OpenBSD: job.c,v 1.59 2021/02/19 09:09:16 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
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);
-/* $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>
* 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