aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
Diffstat (limited to 'internal')
-rw-r--r--internal/fusefrontend/file.go7
-rw-r--r--internal/fusefrontend/fs_dir.go2
2 files changed, 5 insertions, 4 deletions
diff --git a/internal/fusefrontend/file.go b/internal/fusefrontend/file.go
index 62303df..96a07fc 100644
--- a/internal/fusefrontend/file.go
+++ b/internal/fusefrontend/file.go
@@ -361,10 +361,11 @@ func (f *file) Truncate(newSize uint64) fuse.Status {
}
wlock.lock(f.ino)
defer wlock.unlock(f.ino)
+ var err error
// Common case first: Truncate to zero
if newSize == 0 {
- err := syscall.Ftruncate(int(f.fd.Fd()), 0)
+ err = syscall.Ftruncate(int(f.fd.Fd()), 0)
if err != nil {
toggledlog.Warn.Printf("ino%d fh%d: Ftruncate(fd, 0) returned error: %v", f.ino, f.intFd(), err)
return fuse.ToStatus(err)
@@ -398,7 +399,7 @@ func (f *file) Truncate(newSize uint64) fuse.Status {
// File was empty, create new header
if oldSize == 0 {
- err := f.createHeader()
+ err = f.createHeader()
if err != nil {
return fuse.ToStatus(err)
}
@@ -416,7 +417,7 @@ func (f *file) Truncate(newSize uint64) fuse.Status {
}
} else {
off, length := b.CiphertextRange()
- err := syscall.Ftruncate(int(f.fd.Fd()), int64(off+length))
+ err = syscall.Ftruncate(int(f.fd.Fd()), int64(off+length))
if err != nil {
toggledlog.Warn.Printf("grow Ftruncate returned error: %v", err)
return fuse.ToStatus(err)
diff --git a/internal/fusefrontend/fs_dir.go b/internal/fusefrontend/fs_dir.go
index e946087..b7d33ff 100644
--- a/internal/fusefrontend/fs_dir.go
+++ b/internal/fusefrontend/fs_dir.go
@@ -137,7 +137,7 @@ func (fs *FS) Rmdir(path string, context *fuse.Context) (code fuse.Status) {
// Undo the chmod if removing the directory failed
defer func() {
if code != fuse.OK {
- err := os.Chmod(cPath, origMode)
+ err = os.Chmod(cPath, origMode)
if err != nil {
toggledlog.Warn.Printf("Rmdir: Chmod rollback failed: %v", err)
}