summaryrefslogtreecommitdiffstats
path: root/client.c
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 /client.c
parent6e99a2f4bbf21409921a6b54ce29702adda8d034 (diff)
parentd17c90583a2cbbb15ec1a357380b0985e6472a5f (diff)
Merge branch 'obsd-master'
Diffstat (limited to 'client.c')
-rw-r--r--client.c8
1 files changed, 4 insertions, 4 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 = "";