From 701f29719c86856421ae02770e7504e12d2f5749 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Mon, 1 Jan 2018 11:19:09 +0000 Subject: Prefer PWD for current directory if present in client, from Wei Zhao in GitHub issue 1183. --- usr.bin/tmux/client.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'usr.bin/tmux/client.c') diff --git a/usr.bin/tmux/client.c b/usr.bin/tmux/client.c index bba7cfdc4ec..f3b2ed31d1c 100644 --- a/usr.bin/tmux/client.c +++ b/usr.bin/tmux/client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: client.c,v 1.125 2017/12/19 15:00:39 nicm Exp $ */ +/* $OpenBSD: client.c,v 1.126 2018/01/01 11:19:08 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -279,10 +279,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 = ""; -- cgit v1.2.3