forked from TrueCloudLab/restic
Fix #1681 should not try to create the mount point if it doesn't exist, rather return an error
This commit is contained in:
parent
6feaf6bd1f
commit
3c03b35212
2 changed files with 2 additions and 8 deletions
|
@ -116,11 +116,8 @@ func runMount(opts MountOptions, gopts GlobalOptions, args []string) error {
|
||||||
mountpoint := args[0]
|
mountpoint := args[0]
|
||||||
|
|
||||||
if _, err := resticfs.Stat(mountpoint); os.IsNotExist(errors.Cause(err)) {
|
if _, err := resticfs.Stat(mountpoint); os.IsNotExist(errors.Cause(err)) {
|
||||||
Verbosef("Mountpoint %s doesn't exist, creating it\n", mountpoint)
|
Verbosef("Mountpoint %s doesn't exist\n", mountpoint)
|
||||||
err = resticfs.Mkdir(mountpoint, os.ModeDir|0700)
|
return err
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
mountOptions := []systemFuse.MountOption{
|
mountOptions := []systemFuse.MountOption{
|
||||||
systemFuse.ReadOnly(),
|
systemFuse.ReadOnly(),
|
||||||
|
|
|
@ -163,9 +163,6 @@ func TestMount(t *testing.T) {
|
||||||
repo, err := OpenRepository(env.gopts)
|
repo, err := OpenRepository(env.gopts)
|
||||||
rtest.OK(t, err)
|
rtest.OK(t, err)
|
||||||
|
|
||||||
// We remove the mountpoint now to check that cmdMount creates it
|
|
||||||
rtest.RemoveAll(t, env.mountpoint)
|
|
||||||
|
|
||||||
checkSnapshots(t, env.gopts, repo, env.mountpoint, env.repo, []restic.ID{}, 0)
|
checkSnapshots(t, env.gopts, repo, env.mountpoint, env.repo, []restic.ID{}, 0)
|
||||||
|
|
||||||
rtest.SetupTarTestFixture(t, env.testdata, filepath.Join("testdata", "backup-data.tar.gz"))
|
rtest.SetupTarTestFixture(t, env.testdata, filepath.Join("testdata", "backup-data.tar.gz"))
|
||||||
|
|
Loading…
Reference in a new issue