From 76ffb37444045eea5112d886a4b2a4faf6cfe034 Mon Sep 17 00:00:00 2001 From: Simon Arlott <70171+nomis@users.noreply.github.com> Date: Thu, 3 Sep 2020 08:13:24 +0100 Subject: Unset OLDPWD environment variable (#227) If ssh is configured to use "Match exec" and the previous working directory is the mount point, then the shell (bash) hangs calling stat() on OLDPWD. Unset OLDPWD so that this doesn't happen. Fixes #206. --- sshfs.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sshfs.c b/sshfs.c index b102dbd..d5f2ff7 100644 --- a/sshfs.c +++ b/sshfs.c @@ -1189,6 +1189,12 @@ static int start_ssh(struct conn *conn) _exit(0); } chdir("/"); + /* + * Avoid processes hanging trying to stat() OLDPWD if it is in + * the mount point. This can be removed if sshfs opens the + * mount point after establishing the ssh connection. + */ + unsetenv("OLDPWD"); if (sshfs.password_stdin) { int sfd; -- cgit v1.2.3