From 3c03b35212f25092e025fe0348723dde7d6a8489 Mon Sep 17 00:00:00 2001 From: kitone Date: Sun, 11 Oct 2020 11:39:35 +0200 Subject: [PATCH] Fix #1681 should not try to create the mount point if it doesn't exist, rather return an error --- cmd/restic/cmd_mount.go | 7 ++----- cmd/restic/integration_fuse_test.go | 3 --- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/cmd/restic/cmd_mount.go b/cmd/restic/cmd_mount.go index 43cce17ca..2dc5367ce 100644 --- a/cmd/restic/cmd_mount.go +++ b/cmd/restic/cmd_mount.go @@ -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(), diff --git a/cmd/restic/integration_fuse_test.go b/cmd/restic/integration_fuse_test.go index 3ddf33907..17e73abc6 100644 --- a/cmd/restic/integration_fuse_test.go +++ b/cmd/restic/integration_fuse_test.go @@ -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"))