From 3a7b9d57355c4b2b521f05049a5c6f5eb2939b5d Mon Sep 17 00:00:00 2001 From: nicm Date: Thu, 22 Nov 2018 10:36:40 +0000 Subject: Do not use PWD unless it actually matches the real working directory. --- client.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'client.c') diff --git a/client.c b/client.c index 7e8bd734..1054ccae 100644 --- a/client.c +++ b/client.c @@ -222,7 +222,7 @@ client_main(struct event_base *base, int argc, char **argv, int flags) const char *ttynam, *cwd; pid_t ppid; enum msgtype msg; - char *cause, path[PATH_MAX]; + char *cause; struct termios tio, saved_tio; size_t size; @@ -277,9 +277,7 @@ 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 = getenv("PWD")) == NULL && - (cwd = getcwd(path, sizeof path)) == NULL && - (cwd = find_home()) == NULL) + if ((cwd = find_cwd()) == NULL && (cwd = find_home()) == NULL) cwd = "/"; if ((ttynam = ttyname(STDIN_FILENO)) == NULL) ttynam = ""; -- cgit