summaryrefslogtreecommitdiffstats
path: root/client.c
diff options
context:
space:
mode:
authornicm <nicm>2018-11-22 10:36:40 +0000
committernicm <nicm>2018-11-22 10:36:40 +0000
commit3a7b9d57355c4b2b521f05049a5c6f5eb2939b5d (patch)
treee8745b18e9ba6095e272c954deb83f244e87a6f8 /client.c
parent749f67b7d801eed03345fef9c04206fbd079c3cb (diff)
Do not use PWD unless it actually matches the real working directory.
Diffstat (limited to 'client.c')
-rw-r--r--client.c6
1 files changed, 2 insertions, 4 deletions
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 = "";