summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2018-01-01 12:01:13 +0000
committerThomas Adam <thomas@xteddy.org>2018-01-01 12:01:13 +0000
commit06684c93de3e5fbc01bf6749c62defffaa07c52c (patch)
tree1294805dfef1c6193a631ed8c5483104e7bb8322
parent6e99a2f4bbf21409921a6b54ce29702adda8d034 (diff)
parentd17c90583a2cbbb15ec1a357380b0985e6472a5f (diff)
Merge branch 'obsd-master'
-rw-r--r--client.c8
-rw-r--r--status.c1
-rw-r--r--tmux.c7
3 files changed, 9 insertions, 7 deletions
diff --git a/client.c b/client.c
index 845736cb..2ef154db 100644
--- a/client.c
+++ b/client.c
@@ -278,10 +278,10 @@ client_main(struct event_base *base, int argc, char **argv, int flags)
client_peer = proc_add_peer(client_proc, fd, client_dispatch, NULL);
/* Save these before pledge(). */
- if ((cwd = getcwd(path, sizeof path)) == NULL) {
- if ((cwd = find_home()) == NULL)
- cwd = "/";
- }
+ if ((cwd = getenv("PWD")) == NULL &&
+ (cwd = getcwd(path, sizeof path)) == NULL &&
+ (cwd = find_home()) == NULL)
+ cwd = "/";
if ((ttynam = ttyname(STDIN_FILENO)) == NULL)
ttynam = "";
diff --git a/status.c b/status.c
index fffdb327..2f6fc4cb 100644
--- a/status.c
+++ b/status.c
@@ -1339,6 +1339,7 @@ process_key:
break;
case '\033': /* Escape */
case '\003': /* C-c */
+ case '\007': /* C-g */
if (c->prompt_inputcb(c, c->prompt_data, NULL, 1) == 0)
status_prompt_clear(c);
break;
diff --git a/tmux.c b/tmux.c
index 78cb499b..818da3b0 100644
--- a/tmux.c
+++ b/tmux.c
@@ -190,7 +190,7 @@ main(int argc, char **argv)
{
char *path, *label, **var;
char tmp[PATH_MAX];
- const char *s, *shell;
+ const char *s, *shell, *cwd;
int opt, flags, keys;
const struct options_table_entry *oe;
@@ -294,8 +294,9 @@ main(int argc, char **argv)
global_environ = environ_create();
for (var = environ; *var != NULL; var++)
environ_put(global_environ, *var);
- if (getcwd(tmp, sizeof tmp) != NULL)
- environ_set(global_environ, "PWD", "%s", tmp);
+ if ((cwd = getenv("PWD")) == NULL &&
+ (cwd = getcwd(tmp, sizeof tmp)) != NULL)
+ environ_set(global_environ, "PWD", "%s", cwd);
global_options = options_create(NULL);
global_s_options = options_create(NULL);