Skip to content

Commit a985096

Browse files
committed
contrib: pam_mount: check if something is already mounted on DST
pam_mount is supposed to check that as well, but it seems to get confused by the "command#path" syntax used for FUSE. Let's do it here.
1 parent e220b24 commit a985096

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

contrib/pam_mount/gocryptfs_pam_mount.bash

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99

1010
exec >&2
1111
set -eu
12+
MYNAME=$(basename $0)
1213

1314
if [[ $# != 4 ]]; then
14-
MYNAME=$(basename $0)
1515
echo "$MYNAME: expected 4 arguments, got $#"
1616
echo "Example: $MYNAME /home/user.crypt /home/user.plain -o allow_other"
1717
echo "Example: $MYNAME /home/user.crypt /home/user.plain -o defaults"
@@ -20,6 +20,12 @@ fi
2020

2121
SRC=$1
2222
DST=$2
23+
24+
if mountpoint "$DST" > /dev/null; then
25+
echo "$MYNAME: something is already mounted on $DST, refusing"
26+
exit 2
27+
fi
28+
2329
GOPTS=""
2430
for OPT in nonempty allow_other quiet; do
2531
if [[ $4 == *$OPT* ]]; then

0 commit comments

Comments
 (0)