diff --git a/internal/fs/file.go b/internal/fs/file.go index 1071f4e87..356b466c3 100644 --- a/internal/fs/file.go +++ b/internal/fs/file.go @@ -88,15 +88,6 @@ func OpenFile(name string, flag int, perm os.FileMode) (*os.File, error) { return os.OpenFile(fixpath(name), flag, perm) } -// RemoveIfExists removes a file, returning no error if it does not exist. -func RemoveIfExists(filename string) error { - err := os.Remove(filename) - if err != nil && os.IsNotExist(err) { - err = nil - } - return err -} - // Chtimes changes the access and modification times of the named file, // similar to the Unix utime() or utimes() functions. // diff --git a/internal/repository/packer_manager.go b/internal/repository/packer_manager.go index 8dd8f71c1..731ad9a6a 100644 --- a/internal/repository/packer_manager.go +++ b/internal/repository/packer_manager.go @@ -6,7 +6,6 @@ import ( "crypto/sha256" "io" "os" - "runtime" "sync" "github.com/restic/restic/internal/backend" @@ -186,14 +185,6 @@ func (r *Repository) savePacker(ctx context.Context, t restic.BlobType, p *packe return errors.Wrap(err, "close tempfile") } - // on windows the tempfile is automatically deleted on close - if runtime.GOOS != "windows" { - err = fs.RemoveIfExists(p.tmpfile.Name()) - if err != nil { - return errors.WithStack(err) - } - } - // update blobs in the index debug.Log(" updating blobs %v to pack %v", p.Packer.Blobs(), id) r.idx.StorePack(id, p.Packer.Blobs())