aboutsummaryrefslogtreecommitdiff
path: root/pathfs_frontend/file.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2015-09-08 22:34:23 +0200
committerJakob Unterwurzacher2015-09-08 22:34:23 +0200
commitb13cc9686c5497cf1e5971689d1112056ee10651 (patch)
tree8aa5e63bcd9b22f8e528640cc8552700b82b6832 /pathfs_frontend/file.go
parent1ca4fc89aac5482f1294b1ffabc1912c2fb99a82 (diff)
Fix append issue
Diffstat (limited to 'pathfs_frontend/file.go')
-rw-r--r--pathfs_frontend/file.go3
1 files changed, 2 insertions, 1 deletions
diff --git a/pathfs_frontend/file.go b/pathfs_frontend/file.go
index d94fe1b..6e7b4a1 100644
--- a/pathfs_frontend/file.go
+++ b/pathfs_frontend/file.go
@@ -56,6 +56,7 @@ func (f *file) doRead(off uint64, length uint64) ([]byte, fuse.Status) {
// Read the backing ciphertext in one go
alignedOffset, alignedLength, skip := f.cfs.CiphertextRange(off, length)
+ cryptfs.Debug.Printf("CiphertextRange(%d, %d) -> %d, %d, %d\n", off, length, alignedOffset, alignedLength, skip)
ciphertext := make([]byte, int(alignedLength))
n, err := f.fd.ReadAt(ciphertext, int64(alignedOffset))
ciphertext = ciphertext[0:n]
@@ -121,7 +122,7 @@ func (f *file) Write(data []byte, off int64) (uint32, fuse.Status) {
if b.IsPartial() {
// Read
o, _ := b.PlaintextRange()
- oldData, status := f.doRead(f.cfs.PlainBS(), o)
+ oldData, status := f.doRead(o, f.cfs.PlainBS())
if status != fuse.OK {
cryptfs.Warn.Printf("RMW read failed: %s\n", status.String())
return written, status