Fix #1681 should not try to create the mount point if it doesn't exist, rather return an error

This commit is contained in:
kitone 2020-10-11 11:39:35 +02:00 committed by MichaelEischer
parent 6feaf6bd1f
commit 3c03b35212
2 changed files with 2 additions and 8 deletions

View File

@ -116,11 +116,8 @@ func runMount(opts MountOptions, gopts GlobalOptions, args []string) error {
mountpoint := args[0]
if _, err := resticfs.Stat(mountpoint); os.IsNotExist(errors.Cause(err)) {
Verbosef("Mountpoint %s doesn't exist, creating it\n", mountpoint)
err = resticfs.Mkdir(mountpoint, os.ModeDir|0700)
if err != nil {
return err
}
Verbosef("Mountpoint %s doesn't exist\n", mountpoint)
return err
}
mountOptions := []systemFuse.MountOption{
systemFuse.ReadOnly(),

View File

@ -163,9 +163,6 @@ func TestMount(t *testing.T) {
repo, err := OpenRepository(env.gopts)
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)
rtest.SetupTarTestFixture(t, env.testdata, filepath.Join("testdata", "backup-data.tar.gz"))