summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2020-09-03 12:47:33 +0000
committernicm <nicm@openbsd.org>2020-09-03 12:47:33 +0000
commitf3a4b49cdf32f92f01693dad37d301d95443d777 (patch)
treeb70f505eaa90927d9267f59f81202bb698ad929b
parentReplace '.response_format = 2' with '.response_format = SID_SCSI2_RESPONSE'. (diff)
downloadwireguard-openbsd-f3a4b49cdf32f92f01693dad37d301d95443d777.tar.xz
wireguard-openbsd-f3a4b49cdf32f92f01693dad37d301d95443d777.zip
Do not free old session working directory until after expanding the new
one because it may be needed.
-rw-r--r--usr.bin/tmux/cmd-attach-session.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/usr.bin/tmux/cmd-attach-session.c b/usr.bin/tmux/cmd-attach-session.c
index 638f39d0322..3c727ea617b 100644
--- a/usr.bin/tmux/cmd-attach-session.c
+++ b/usr.bin/tmux/cmd-attach-session.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmd-attach-session.c,v 1.84 2020/05/16 15:45:29 nicm Exp $ */
+/* $OpenBSD: cmd-attach-session.c,v 1.85 2020/09/03 12:47:33 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -59,7 +59,7 @@ cmd_attach_session(struct cmdq_item *item, const char *tflag, int dflag,
struct session *s;
struct winlink *wl;
struct window_pane *wp;
- char *cause;
+ char *cwd, *cause;
enum msgtype msgtype;
if (RB_EMPTY(&sessions)) {
@@ -99,8 +99,9 @@ cmd_attach_session(struct cmdq_item *item, const char *tflag, int dflag,
}
if (cflag != NULL) {
+ cwd = format_single(item, cflag, c, s, wl, wp);
free((void *)s->cwd);
- s->cwd = format_single(item, cflag, c, s, wl, wp);
+ s->cwd = cwd;
}
if (fflag)
server_client_set_flags(c, fflag);