Skip to content

Commit

Permalink
Unset OLDPWD environment variable (libfuse#227)
Browse files Browse the repository at this point in the history
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 libfuse#206.
  • Loading branch information
nomis committed Sep 3, 2020
1 parent a96e521 commit 76ffb37
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sshfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 76ffb37

Please sign in to comment.