aboutsummaryrefslogtreecommitdiff
path: root/mount.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2016-10-08 18:39:21 +0200
committerJakob Unterwurzacher2016-10-08 18:43:31 +0200
commit04cdc695f0a9af5d06af84527d4107751f6e5e3a (patch)
tree09c0c004ef5d1ad0ba122f7fc2c88d10ddc458fb /mount.go
parent631c538f13997aa8ab4db40c39178a645adf32c3 (diff)
main: error out when the mount shadows the cipherdir
For example, we cannot mount "/home/user/.cipher" at "/home/user" because the mount will hide ".cipher" also for us. Doing it anyway used to cause a nasty hang.
Diffstat (limited to 'mount.go')
-rw-r--r--mount.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/mount.go b/mount.go
index 56f1dc1..90443ff 100644
--- a/mount.go
+++ b/mount.go
@@ -36,6 +36,13 @@ func doMount(args *argContainer) int {
tlog.Fatal.Printf("Invalid mountpoint: %v", err)
os.Exit(ErrExitMountPoint)
}
+ // We cannot mount "/home/user/.cipher" at "/home/user" because the mount
+ // will hide ".cipher" also for us.
+ if strings.HasPrefix(args.cipherdir, args.mountpoint) {
+ tlog.Fatal.Printf("Mountpoint %q would shadow cipherdir %q, this is not supported",
+ args.mountpoint, args.cipherdir)
+ os.Exit(ErrExitMountPoint)
+ }
if args.nonempty {
err = checkDir(args.mountpoint)
} else {