diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2017-04-21 13:15:44 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2017-04-21 13:15:44 +0000 |
commit | d61eb29d5a000dfaae1387c99742c53ddadadc7c (patch) | |
tree | c84c921a2ef11636b8d2308915770e67dd6d0a9b /usr.bin/tmux | |
parent | 795e09b129ff7bdabb454fae68b3d55902b65513 (diff) |
Do not run the config file in the context of the first client, instead
use no client like we did before. This means commands like new-session
won't try to attach if they are in the config file.
Diffstat (limited to 'usr.bin/tmux')
-rw-r--r-- | usr.bin/tmux/cfg.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/usr.bin/tmux/cfg.c b/usr.bin/tmux/cfg.c index 04e9780ba4a..bc49bb9834c 100644 --- a/usr.bin/tmux/cfg.c +++ b/usr.bin/tmux/cfg.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cfg.c,v 1.55 2017/04/05 10:45:39 nicm Exp $ */ +/* $OpenBSD: cfg.c,v 1.56 2017/04/21 13:15:43 nicm Exp $ */ /* * Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com> @@ -32,7 +32,6 @@ static char *cfg_file; int cfg_finished; static char **cfg_causes; static u_int cfg_ncauses; -struct client *cfg_client; static enum cmd_retval cfg_done(__unused struct cmdq_item *item, __unused void *data) @@ -44,8 +43,6 @@ cfg_done(__unused struct cmdq_item *item, __unused void *data) if (!RB_EMPTY(&sessions)) cfg_show_causes(RB_MIN(sessions, &sessions)); - if (cfg_client != NULL) - server_client_unref(cfg_client); return (CMD_RETURN_NORMAL); } @@ -62,20 +59,22 @@ start_cfg(void) const char *home; int quiet = 0; - cfg_client = TAILQ_FIRST(&clients); - if (cfg_client != NULL) - cfg_client->references++; + /* + * Note that the configuration files are loaded without a client, so + * NULL is passed into load_cfg() which means that commands run in the + * global queue and item->client is NULL for all commands. + */ - load_cfg(TMUX_CONF, cfg_client, NULL, 1); + load_cfg(TMUX_CONF, NULL, NULL, 1); if (cfg_file == NULL && (home = find_home()) != NULL) { xasprintf(&cfg_file, "%s/.tmux.conf", home); quiet = 1; } if (cfg_file != NULL) - load_cfg(cfg_file, cfg_client, NULL, quiet); + load_cfg(cfg_file, NULL, NULL, quiet); - cmdq_append(cfg_client, cmdq_get_callback(cfg_done, NULL)); + cmdq_append(NULL, cmdq_get_callback(cfg_done, NULL)); } int |