summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2019-02-16 11:42:09 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2019-02-16 11:42:09 +0000
commit6d8c90a6ec44a4c9a63b843aa07b6ff2de79f305 (patch)
treeed229730cfee1fd1422c6d5675fdd815f04e75cd /usr.bin
parent977df67f5c2088c56109f41758b1ade7ae455977 (diff)
Use starting client cwd in config file, GitHub issue 1606.
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/tmux/cfg.c5
-rw-r--r--usr.bin/tmux/server-client.c4
-rw-r--r--usr.bin/tmux/tmux.h3
3 files changed, 8 insertions, 4 deletions
diff --git a/usr.bin/tmux/cfg.c b/usr.bin/tmux/cfg.c
index c1bcfe1430e..a6479d884ce 100644
--- a/usr.bin/tmux/cfg.c
+++ b/usr.bin/tmux/cfg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cfg.c,v 1.62 2018/01/15 15:27:03 nicm Exp $ */
+/* $OpenBSD: cfg.c,v 1.63 2019/02/16 11:42:08 nicm Exp $ */
/*
* Copyright (c) 2008 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -38,6 +38,7 @@ struct cfg_cond {
};
TAILQ_HEAD(cfg_conds, cfg_cond);
+struct client *cfg_client;
static char *cfg_file;
int cfg_finished;
static char **cfg_causes;
@@ -95,7 +96,7 @@ start_cfg(void)
* command queue is currently empty and our callback will be at the
* front - we need to get in before MSG_COMMAND.
*/
- c = TAILQ_FIRST(&clients);
+ cfg_client = c = TAILQ_FIRST(&clients);
if (c != NULL) {
cfg_item = cmdq_get_callback(cfg_client_done, NULL);
cmdq_append(c, cfg_item);
diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c
index bf7ae0f54ee..66a7b9ec279 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.264 2018/12/18 13:20:44 nicm Exp $ */
+/* $OpenBSD: server-client.c,v 1.265 2019/02/16 11:42:08 nicm Exp $ */
/*
* Copyright (c) 2009 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1982,6 +1982,8 @@ server_client_get_cwd(struct client *c, struct session *s)
{
const char *home;
+ if (!cfg_finished && cfg_client != NULL)
+ return (cfg_client->cwd);
if (c != NULL && c->session == NULL && c->cwd != NULL)
return (c->cwd);
if (s != NULL && s->cwd != NULL)
diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h
index 6d901cecc72..fd982ee1db3 100644
--- a/usr.bin/tmux/tmux.h
+++ b/usr.bin/tmux/tmux.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: tmux.h,v 1.852 2018/12/18 13:20:44 nicm Exp $ */
+/* $OpenBSD: tmux.h,v 1.853 2019/02/16 11:42:08 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -1527,6 +1527,7 @@ void proc_toggle_log(struct tmuxproc *);
/* cfg.c */
extern int cfg_finished;
+extern struct client *cfg_client;
void start_cfg(void);
int load_cfg(const char *, struct client *, struct cmdq_item *, int);
void set_cfg_file(const char *);