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.
This commit is contained in:
parent
631c538f13
commit
04cdc695f0
7
mount.go
7
mount.go
@ -36,6 +36,13 @@ func doMount(args *argContainer) int {
|
|||||||
tlog.Fatal.Printf("Invalid mountpoint: %v", err)
|
tlog.Fatal.Printf("Invalid mountpoint: %v", err)
|
||||||
os.Exit(ErrExitMountPoint)
|
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 {
|
if args.nonempty {
|
||||||
err = checkDir(args.mountpoint)
|
err = checkDir(args.mountpoint)
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user