Detach the right seesion with -d
Fixes a bug that would detach the wrong session when running
attach-session -dt $sessionname. See
https://trac.macports.org/ticket/50623
for the report. This has been fixed upstream, but the backported patch
looks different because of changes to upstream source code.
Upstream-Status: Backport [https://github.com/tmux/tmux/commit/f2ec911b8a0bb88d23f16b7d9e0f41f29d4ac541]
--- cmd-attach-session.c.old 2015-12-21 05:01:35.060975526 -0800
+++ cmd-attach-session.c 2015-12-21 05:01:40.179848875 -0800
TAILQ_FOREACH(c_loop, &clients, entry) {
if (c_loop->session != s || c == c_loop)
- server_write_client(c, MSG_DETACH,
+ server_write_client(c_loop, MSG_DETACH,
strlen(c_loop->session->name) + 1);