aboutsummaryrefslogtreecommitdiff
path: root/cmd-detach-client.c
diff options
context:
space:
mode:
authorThomas <thomas@xteddy.org>2013-10-11 14:33:29 +0100
committerThomas <thomas@xteddy.org>2013-10-11 14:33:29 +0100
commit7f479ffdce8f49f6c57d575b708c4cbe8cbe18df (patch)
treec0b1ddfb340c9bd59bbc02e83f30bf34aeb29a88 /cmd-detach-client.c
parentc190c73240576aa2a8274a305844f1fa7fcb0e71 (diff)
parent4901d9ddc8d8c33ecdca363dcb67e66482745fa5 (diff)
downloadrtmux-7f479ffdce8f49f6c57d575b708c4cbe8cbe18df.tar.gz
rtmux-7f479ffdce8f49f6c57d575b708c4cbe8cbe18df.tar.bz2
rtmux-7f479ffdce8f49f6c57d575b708c4cbe8cbe18df.zip
Merge branch 'obsd-master' into mtemp
Diffstat (limited to 'cmd-detach-client.c')
-rw-r--r--cmd-detach-client.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/cmd-detach-client.c b/cmd-detach-client.c
index 6e00e079..f0867364 100644
--- a/cmd-detach-client.c
+++ b/cmd-detach-client.c
@@ -18,6 +18,8 @@
#include <sys/types.h>
+#include <string.h>
+
#include "tmux.h"
/*
@@ -32,7 +34,6 @@ const struct cmd_entry cmd_detach_client_entry = {
"[-P] [-a] [-s target-session] " CMD_TARGET_CLIENT_USAGE,
CMD_READONLY,
NULL,
- NULL,
cmd_detach_client_exec
};
@@ -41,8 +42,8 @@ cmd_detach_client_exec(struct cmd *self, struct cmd_q *cmdq)
{
struct args *args = self->args;
struct client *c, *c2;
- struct session *s;
- enum msgtype msgtype;
+ struct session *s;
+ enum msgtype msgtype;
u_int i;
if (args_has(args, 'P'))
@@ -57,8 +58,10 @@ cmd_detach_client_exec(struct cmd *self, struct cmd_q *cmdq)
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
c = ARRAY_ITEM(&clients, i);
- if (c != NULL && c->session == s)
- server_write_client(c, msgtype, NULL, 0);
+ if (c == NULL || c->session != s)
+ continue;
+ server_write_client(c, msgtype, c->session->name,
+ strlen(c->session->name) + 1);
}
} else {
c = cmd_find_client(cmdq, args_get(args, 't'), 0);
@@ -70,10 +73,14 @@ cmd_detach_client_exec(struct cmd *self, struct cmd_q *cmdq)
c2 = ARRAY_ITEM(&clients, i);
if (c2 == NULL || c == c2)
continue;
- server_write_client(c2, msgtype, NULL, 0);
+ server_write_client(c2, msgtype,
+ c2->session->name,
+ strlen(c2->session->name) + 1);
}
- } else
- server_write_client(c, msgtype, NULL, 0);
+ } else {
+ server_write_client(c, msgtype, c->session->name,
+ strlen(c->session->name) + 1);
+ }
}
return (CMD_RETURN_STOP);