diff options
author | 2015-06-04 23:27:51 +0000 | |
---|---|---|
committer | 2015-06-04 23:27:51 +0000 | |
commit | fde81079426c43334bacc36e8a19514caf5a9677 (patch) | |
tree | 9236322d8d7b9f3853e620a1700ba2dfca57edbd /usr.bin/tmux/server-client.c | |
parent | Mention rtwn(4) in pci(4). Reminded by brad. (diff) | |
download | wireguard-openbsd-fde81079426c43334bacc36e8a19514caf5a9677.tar.xz wireguard-openbsd-fde81079426c43334bacc36e8a19514caf5a9677.zip |
Move the nested check from client to server and compare the client tty
name to all the pane pty names instead of comparing socket paths. This
means that "new -d" will work without unsetting $TMUX.
Diffstat (limited to 'usr.bin/tmux/server-client.c')
-rw-r--r-- | usr.bin/tmux/server-client.c | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c index 731b9ea1cf2..e551c41ca9b 100644 --- a/usr.bin/tmux/server-client.c +++ b/usr.bin/tmux/server-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server-client.c,v 1.139 2015/05/27 13:28:04 nicm Exp $ */ +/* $OpenBSD: server-client.c,v 1.140 2015/06/04 23:27:51 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -46,6 +46,27 @@ void server_client_msg_command(struct client *, struct imsg *); void server_client_msg_identify(struct client *, struct imsg *); void server_client_msg_shell(struct client *); +/* Check if this client is inside this server. */ +int +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) + return (1); + } + return (0); +} + /* Set client key table. */ void server_client_key_table(struct client *c, const char *name) |