diff --git a/cmd/mount/read.go b/cmd/mount/read.go index f3b8ca993..3fd4f0128 100644 --- a/cmd/mount/read.go +++ b/cmd/mount/read.go @@ -44,7 +44,7 @@ func (fh *ReadFileHandle) seek(offset int64) error { // Can we seek it directly? if do, ok := fh.r.(io.Seeker); ok { fs.Debug(fh.o, "ReadFileHandle.seek from %d to %d (io.Seeker)", fh.offset, offset) - _, err := do.Seek(offset, io.SeekStart) + _, err := do.Seek(offset, 0) if err != nil { fs.Debug(fh.o, "ReadFileHandle.Read io.Seeker failed: %v", err) return err diff --git a/crypt/cipher.go b/crypt/cipher.go index 3b92d81d8..87747a553 100644 --- a/crypt/cipher.go +++ b/crypt/cipher.go @@ -542,7 +542,7 @@ func (c *cipher) newDecrypterSeek(open OpenAtOffset, offset int64) (fh *decrypte } fh.open = open // will be called by fh.Seek if offset != 0 { - _, err = fh.Seek(offset, io.SeekStart) + _, err = fh.Seek(offset, 0) if err != nil { _ = fh.Close() return nil, err @@ -593,7 +593,7 @@ func (fh *decrypter) Seek(offset int64, whence int) (int64, error) { if fh.open == nil { return 0, fh.finish(errors.New("can't seek - not initialised with newDecrypterSeek")) } - if whence != io.SeekStart { + if whence != 0 { return 0, fh.finish(errors.New("can only seek from the start")) } @@ -606,7 +606,7 @@ func (fh *decrypter) Seek(offset int64, whence int) (int64, error) { // Can we seek it directly? if do, ok := fh.rc.(io.Seeker); ok { - _, err := do.Seek(offset, io.SeekStart) + _, err := do.Seek(offset, 0) if err != nil { return 0, fh.finish(err) } diff --git a/crypt/cipher_test.go b/crypt/cipher_test.go index 76dcd1133..384b83155 100644 --- a/crypt/cipher_test.go +++ b/crypt/cipher_test.go @@ -895,7 +895,7 @@ func TestNewDecrypterSeek(t *testing.T) { // Now try decoding it with a single open and lots of seeks rc, err := c.DecryptDataSeek(open, 0) for _, offset := range trials { - _, err := rc.Seek(int64(offset), io.SeekStart) + _, err := rc.Seek(int64(offset), 0) assert.NoError(t, err) seekedDecrypted, err := ioutil.ReadAll(rc)