mkmountpoint: directory exists check does not work properly for FUSE filesystems
Brought to you by:
jengelh
When using pam_mount to connect to a sshfs/FUSE file system mkmountpoint tries to create the mount point even if it already exists.
(mount.c:309): mkmountpoint: checking /home
(mount.c:309): mkmountpoint: checking /home/tester
(mount.c:345): mkdir /home/tester failed: File exists
(pam_mount.c:522): mount of sshfs#tester@server: failed
This is caused by you using the stat() system call to check for directory existence.
However with FUSE file systems even the root user does not have permission to stat() FUSE mounts created by an user, unless mounted with "allow_root"
I think that if stat fails with errno==EACCES you should treat it as if the directory already exists.