summaryrefslogtreecommitdiffstats
path: root/cfg.c
diff options
context:
space:
mode:
authornicm <nicm>2013-10-20 17:28:43 +0000
committernicm <nicm>2013-10-20 17:28:43 +0000
commitbf35441608b05d52627215aa70bd52d9460812d4 (patch)
treebfca70f3b3a04d09511654a960fa5389cde22d37 /cfg.c
parentf52eac62259c431daac84ddb6c2a5b7ebd528c2c (diff)
Do not run any command line command from the client which starts the
server until after the configuration file completes. This prevents it racing against run-shell or if-shell in .tmux.conf that run in the background.
Diffstat (limited to 'cfg.c')
-rw-r--r--cfg.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/cfg.c b/cfg.c
index c625a2fb..35192dc0 100644
--- a/cfg.c
+++ b/cfg.c
@@ -31,6 +31,7 @@ struct cmd_q *cfg_cmd_q;
int cfg_finished;
int cfg_references;
struct causelist cfg_causes;
+struct client *cfg_client;
int
load_cfg(const char *path, struct cmd_q *cmdq, char **cause)
@@ -127,6 +128,20 @@ cfg_default_done(unused struct cmd_q *cmdq)
cmdq_free(cfg_cmd_q);
cfg_cmd_q = NULL;
+
+ if (cfg_client != NULL) {
+ /*
+ * The client command queue starts with client_exit set to 1 so
+ * only continue if not empty (that is, we have been delayed
+ * during configuration parsing for long enough that the
+ * MSG_COMMAND has arrived), else the client will exit before
+ * the MSG_COMMAND which might tell it not to.
+ */
+ if (!TAILQ_EMPTY(&cfg_client->cmdq->queue))
+ cmdq_continue(cfg_client->cmdq);
+ cfg_client->references--;
+ cfg_client = NULL;
+ }
}
void