summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/cmd-attach-session.c
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/tmux/cmd-attach-session.c')
-rw-r--r--usr.bin/tmux/cmd-attach-session.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/usr.bin/tmux/cmd-attach-session.c b/usr.bin/tmux/cmd-attach-session.c
index 37ad2ce3e43..27cb69a1493 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.42 2015/09/16 22:29:30 nicm Exp $ */
+/* $OpenBSD: cmd-attach-session.c,v 1.43 2015/10/27 13:23:24 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@@ -113,16 +113,10 @@ cmd_attach_session(struct cmd_q *cmdq, const char *tflag, int dflag, int rflag,
if (c->session != NULL) {
if (dflag) {
- /*
- * Can't use server_write_session in case attaching to
- * the same session as currently attached to.
- */
TAILQ_FOREACH(c_loop, &clients, entry) {
if (c_loop->session != s || c == c_loop)
continue;
- server_write_client(c, MSG_DETACH,
- c_loop->session->name,
- strlen(c_loop->session->name) + 1);
+ proc_send_s(c->peer, MSG_DETACH, s->name);
}
}
@@ -150,8 +144,11 @@ cmd_attach_session(struct cmd_q *cmdq, const char *tflag, int dflag, int rflag,
c->flags |= CLIENT_READONLY;
if (dflag) {
- server_write_session(s, MSG_DETACH, s->name,
- strlen(s->name) + 1);
+ TAILQ_FOREACH(c_loop, &clients, entry) {
+ if (c_loop->session != s || c == c_loop)
+ continue;
+ proc_send_s(c->peer, MSG_DETACH, s->name);
+ }
}
if (!Eflag) {
@@ -168,7 +165,8 @@ cmd_attach_session(struct cmd_q *cmdq, const char *tflag, int dflag, int rflag,
server_redraw_client(c);
s->curw->flags &= ~WINLINK_ALERTFLAGS;
- server_write_ready(c);
+ if (~c->flags & CLIENT_CONTROL)
+ proc_send(c->peer, MSG_READY, -1, NULL, 0);
cmdq->client_exit = 0;
}
recalculate_sizes();