summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/server-client.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2019-06-20 06:51:37 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2019-06-20 06:51:37 +0000
commit799dd7d5ba631a0c88b83bd812ef2aa3f7f5a1ab (patch)
tree390ee818546cfc8814c7bd69d94eec79de9b8b5c /usr.bin/tmux/server-client.c
parentdc716904cbd674ddbd899facdac43bd9775258b0 (diff)
Expand command formats in %if and move the config file loading later (to
when the first client has identified) so all the client formats are available, fixes problems reported by Thomas Sattler.
Diffstat (limited to 'usr.bin/tmux/server-client.c')
-rw-r--r--usr.bin/tmux/server-client.c41
1 files changed, 22 insertions, 19 deletions
diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c
index 9e7b675ac6d..3c1e1469c38 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.287 2019/06/11 13:09:00 nicm Exp $ */
+/* $OpenBSD: server-client.c,v 1.288 2019/06/20 06:51:36 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1934,26 +1934,29 @@ server_client_dispatch_identify(struct client *c, struct imsg *imsg)
close(c->fd);
c->fd = -1;
-
- return;
- }
-
- if (c->fd == -1)
- return;
- if (tty_init(&c->tty, c, c->fd, c->term) != 0) {
- close(c->fd);
- c->fd = -1;
- return;
+ } else if (c->fd != -1) {
+ if (tty_init(&c->tty, c, c->fd, c->term) != 0) {
+ close(c->fd);
+ c->fd = -1;
+ } else {
+ if (c->flags & CLIENT_UTF8)
+ c->tty.flags |= TTY_UTF8;
+ if (c->flags & CLIENT_256COLOURS)
+ c->tty.term_flags |= TERM_256COLOURS;
+ tty_resize(&c->tty);
+ c->flags |= CLIENT_TERMINAL;
+ }
}
- if (c->flags & CLIENT_UTF8)
- c->tty.flags |= TTY_UTF8;
- if (c->flags & CLIENT_256COLOURS)
- c->tty.term_flags |= TERM_256COLOURS;
- tty_resize(&c->tty);
-
- if (!(c->flags & CLIENT_CONTROL))
- c->flags |= CLIENT_TERMINAL;
+ /*
+ * If this is the first client that has finished identifying, load
+ * configuration files.
+ */
+ if ((~c->flags & CLIENT_EXIT) &&
+ !cfg_finished &&
+ c == TAILQ_FIRST(&clients) &&
+ TAILQ_NEXT(c, entry) == NULL)
+ start_cfg();
}
/* Handle shell message. */