summaryrefslogtreecommitdiffstats
path: root/usr.bin/tmux/cmd-split-window.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2015-04-26 20:25:20 +0000
committernicm <nicm@openbsd.org>2015-04-26 20:25:20 +0000
commitce28ecd8e6c42f3838c26a2453baa7fc7079eca5 (patch)
tree18d1ac56db2b0bb303b42de1a66f87039b9e4dcc /usr.bin/tmux/cmd-split-window.c
parentmlarkin asks "bgpctl checks the length of the control socket path to (diff)
downloadwireguard-openbsd-ce28ecd8e6c42f3838c26a2453baa7fc7079eca5.tar.xz
wireguard-openbsd-ce28ecd8e6c42f3838c26a2453baa7fc7079eca5.zip
Remove panes from layout if spawning them fails, reported by Anthony J
Bentley.
Diffstat (limited to 'usr.bin/tmux/cmd-split-window.c')
-rw-r--r--usr.bin/tmux/cmd-split-window.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/usr.bin/tmux/cmd-split-window.c b/usr.bin/tmux/cmd-split-window.c
index 77af6aff117..b774b753971 100644
--- a/usr.bin/tmux/cmd-split-window.c
+++ b/usr.bin/tmux/cmd-split-window.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-split-window.c,v 1.56 2015/02/05 10:32:39 nicm Exp $ */
+/* $OpenBSD: cmd-split-window.c,v 1.57 2015/04/26 20:25:20 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -147,6 +147,7 @@ cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq)
goto error;
}
new_wp = window_add_pane(w, hlimit);
+ layout_assign_pane(lc, new_wp);
path = NULL;
if (cmdq->client != NULL && cmdq->client->session == NULL)
@@ -159,7 +160,6 @@ cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq)
if (window_pane_spawn(new_wp, argc, argv, path, shell, cwd, &env,
s->tio, &cause) != 0)
goto error;
- layout_assign_pane(lc, new_wp);
server_redraw_window(w);
@@ -194,8 +194,10 @@ cmd_split_window_exec(struct cmd *self, struct cmd_q *cmdq)
error:
environ_free(&env);
- if (new_wp != NULL)
+ if (new_wp != NULL) {
+ layout_close_pane(new_wp);
window_remove_pane(w, new_wp);
+ }
cmdq_error(cmdq, "create pane failed: %s", cause);
free(cause);
if (fd != -1)