allow /dev/fd/N as a mountpoint (#166)

This commit is contained in:
DrDaveD 2019-03-31 03:57:21 -05:00 committed by Nikolaus Rath
parent d299217510
commit 1dbc89f959
1 changed files with 13 additions and 1 deletions

14
sshfs.c
View File

@ -3471,7 +3471,19 @@ static int sshfs_opt_proc(void *data, const char *arg, int key,
}
}
#else
sshfs.mountpoint = realpath(arg, NULL);
int fd, len;
if (sscanf(arg, "/dev/fd/%u%n", &fd, &len) == 1 &&
len == strlen(arg)) {
/*
* Allow /dev/fd/N unchanged; it can be
* use for pre-mounting a generic fuse
* mountpoint to later be completely
* unprivileged with libfuse >= 3.3.0.
*/
sshfs.mountpoint = arg;
} else {
sshfs.mountpoint = realpath(arg, NULL);
}
#endif
if (!sshfs.mountpoint) {
fprintf(stderr, "sshfs: bad mount point `%s': %s\n",