diff options
author | Thomas Adam <thomas@xteddy.org> | 2017-04-06 11:10:17 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2017-04-06 11:10:17 +0100 |
commit | 5f662d91db658abbcd46d7a678c0250754be35e3 (patch) | |
tree | bed316d0ce8c4a770b5e42608a36dafc0a9eee2d /server-client.c | |
parent | 05c97d7fe9ede1b9d185ed21242eb8470350affc (diff) | |
parent | 94b71bcb6403d381515319b08a85878b829785d5 (diff) | |
download | rtmux-5f662d91db658abbcd46d7a678c0250754be35e3.tar.gz rtmux-5f662d91db658abbcd46d7a678c0250754be35e3.tar.bz2 rtmux-5f662d91db658abbcd46d7a678c0250754be35e3.zip |
Merge branch 'obsd-master'
Conflicts:
server-client.c
tmux.1
Diffstat (limited to 'server-client.c')
-rw-r--r-- | server-client.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/server-client.c b/server-client.c index 1e36b2df..e6d350ab 100644 --- a/server-client.c +++ b/server-client.c @@ -97,15 +97,12 @@ server_client_check_nested(struct client *c) struct environ_entry *envent; struct window_pane *wp; - if (c->tty.path == NULL) - return (0); - envent = environ_find(c->environ, "TMUX"); if (envent == NULL || *envent->value == '\0') return (0); RB_FOREACH(wp, window_pane_tree, &all_window_panes) { - if (strcmp(wp->tty, c->tty.path) == 0) + if (strcmp(wp->tty, c->ttyname) == 0) return (1); } return (0); @@ -320,8 +317,10 @@ server_client_free(__unused int fd, __unused short events, void *arg) if (!TAILQ_EMPTY(&c->queue)) fatalx("queue not empty"); - if (c->references == 0) + if (c->references == 0) { + free((void *)c->name); free(c); + } } /* Detach a client. */ @@ -1478,6 +1477,7 @@ server_client_dispatch_identify(struct client *c, struct imsg *imsg) const char *data, *home; size_t datalen; int flags; + char *name; if (c->flags & CLIENT_IDENTIFIED) fatalx("out-of-order identify message"); @@ -1543,6 +1543,13 @@ server_client_dispatch_identify(struct client *c, struct imsg *imsg) return; c->flags |= CLIENT_IDENTIFIED; + if (*c->ttyname != '\0') + name = xstrdup(c->ttyname); + else + xasprintf(&name, "client-%ld", (long)c->pid); + c->name = name; + log_debug("client %p name is %s", c, c->name); + #ifdef __CYGWIN__ c->fd = open(c->ttyname, O_RDWR|O_NOCTTY); #endif @@ -1697,7 +1704,7 @@ server_client_add_message(struct client *c, const char *fmt, ...) xvasprintf(&s, fmt, ap); va_end(ap); - log_debug("%s: message %s", c->tty.path, s); + log_debug("message %s (client %p)", s, c); msg = xcalloc(1, sizeof *msg); msg->msg_time = time(NULL); |