aboutsummaryrefslogtreecommitdiff
path: root/spawn.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2021-03-02 12:08:34 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2021-03-02 12:08:34 +0000
commitc01251d02388efceca515c47c257e2b5342e3716 (patch)
treeca89407cb43bd2caa40a6854ba49ce1720e892ce /spawn.c
parent5c275c2a1a963876d4ac392067e42120417dbf43 (diff)
parent1466b570eedda0423d5a386d2b16b7ff0c0e477c (diff)
downloadrtmux-c01251d02388efceca515c47c257e2b5342e3716.tar.gz
rtmux-c01251d02388efceca515c47c257e2b5342e3716.tar.bz2
rtmux-c01251d02388efceca515c47c257e2b5342e3716.zip
Merge branch 'master' into 3.2-rc
Diffstat (limited to 'spawn.c')
-rw-r--r--spawn.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/spawn.c b/spawn.c
index 7c279eff..c47b11f4 100644
--- a/spawn.c
+++ b/spawn.c
@@ -182,7 +182,7 @@ spawn_window(struct spawn_context *sc, char **cause)
NULL);
options_set_number(w->options, "automatic-rename", 0);
} else
- w->name = xstrdup(default_window_name(w));
+ w->name = default_window_name(w);
}
/* Switch to the new window if required. */
@@ -263,8 +263,9 @@ spawn_pane(struct spawn_context *sc, char **cause)
}
/*
- * Now we have a pane with nothing running in it ready for the new process.
- * Work out the command and arguments and store the working directory.
+ * Now we have a pane with nothing running in it ready for the new
+ * process. Work out the command and arguments and store the working
+ * directory.
*/
if (sc->argc == 0 && (~sc->flags & SPAWN_RESPAWN)) {
cmd = options_get_string(s->options, "default-command");
@@ -377,10 +378,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