1
0
mirror of https://github.com/rclone/rclone.git synced 2025-12-06 00:03:32 +00:00

vfs: Don't error a r/w file open without cache; delay error until Read called

If we open a file for r/w without the cache we now always return a
handle and return an error if the file is ever read from.  This fixes
incompatibility with cmount under windows.
This commit is contained in:
Nick Craig-Wood
2017-11-16 10:55:24 +00:00
parent dec21ccf63
commit 992647b157
4 changed files with 30 additions and 5 deletions

View File

@@ -56,6 +56,15 @@ func TestWriteFileHandleMethods(t *testing.T) {
assert.Equal(t, int64(5), fi.Size())
assert.Equal(t, "file1", fi.Name())
// Read
var buf = make([]byte, 16)
_, err = fh.Read(buf)
assert.Equal(t, EPERM, err)
// ReadAt
_, err = fh.ReadAt(buf, 0)
assert.Equal(t, EPERM, err)
// Close
assert.NoError(t, fh.Close())