summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mount.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/mount.go b/mount.go
index 4f57381..007cc46 100644
--- a/mount.go
+++ b/mount.go
@@ -47,6 +47,13 @@ func doMount(args *argContainer) int {
args.mountpoint, args.cipherdir)
os.Exit(exitcodes.MountPoint)
}
+ // Reverse-mounting "/foo" at "/foo/mnt" means we would be recursively
+ // encrypting ourselves.
+ if strings.HasPrefix(args.mountpoint, args.cipherdir+"/") {
+ tlog.Fatal.Printf("Mountpoint %q is contained in cipherdir %q, this is not supported",
+ args.mountpoint, args.cipherdir)
+ os.Exit(exitcodes.MountPoint)
+ }
if args.nonempty {
err = checkDir(args.mountpoint)
} else {