aboutsummaryrefslogtreecommitdiff
path: root/server-client.c
diff options
context:
space:
mode:
authornicm <nicm>2019-06-20 06:51:36 +0000
committernicm <nicm>2019-06-20 06:51:36 +0000
commitae541287d303fb253b3cd75341c318dcc6a8db4a (patch)
tree6994a84529e649566cc0d1e4e4f2a6367f190422 /server-client.c
parent250fdd08bea74f47fc9a8962d5688db353896921 (diff)
downloadrtmux-ae541287d303fb253b3cd75341c318dcc6a8db4a.tar.gz
rtmux-ae541287d303fb253b3cd75341c318dcc6a8db4a.tar.bz2
rtmux-ae541287d303fb253b3cd75341c318dcc6a8db4a.zip
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 'server-client.c')
-rw-r--r--server-client.c39
1 files changed, 21 insertions, 18 deletions
diff --git a/server-client.c b/server-client.c
index dc57e523..14c20617 100644
--- a/server-client.c
+++ b/server-client.c
@@ -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. */