From d17c90583a2cbbb15ec1a357380b0985e6472a5f Mon Sep 17 00:00:00 2001 From: nicm Date: Mon, 1 Jan 2018 11:19:08 +0000 Subject: Prefer PWD for current directory if present in client, from Wei Zhao in GitHub issue 1183. --- client.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'client.c') diff --git a/client.c b/client.c index 6feafc93..aa6b596f 100644 --- a/client.c +++ b/client.c @@ -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