diff options
author | Jakob Unterwurzacher | 2016-04-10 21:29:42 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2016-04-10 21:31:15 +0200 |
commit | bd5405189eb27d463e25c43691b19dbdf174d3a8 (patch) | |
tree | a78d909a5fac9b3c642ea5c1a715a08bffa54965 /internal/fusefrontend | |
parent | bd1f17ca9f210b318e28d7ed233698b950d564b8 (diff) |
Fix "go tool vet -shadow=true" warnings
Among those one real bug.
Diffstat (limited to 'internal/fusefrontend')
-rw-r--r-- | internal/fusefrontend/file.go | 3 | ||||
-rw-r--r-- | internal/fusefrontend/fs.go | 18 | ||||
-rw-r--r-- | internal/fusefrontend/fs_dir.go | 3 |
3 files changed, 16 insertions, 8 deletions
diff --git a/internal/fusefrontend/file.go b/internal/fusefrontend/file.go index c93c384..0d26329 100644 --- a/internal/fusefrontend/file.go +++ b/internal/fusefrontend/file.go @@ -236,7 +236,8 @@ func (f *file) doWrite(data []byte, off int64) (uint32, fuse.Status) { if b.IsPartial() { // Read o, _ := b.PlaintextRange() - oldData, status := f.doRead(o, f.contentEnc.PlainBS()) + var oldData []byte + oldData, status = f.doRead(o, f.contentEnc.PlainBS()) if status != fuse.OK { toggledlog.Warn.Printf("ino%d fh%d: RMW read failed: %s", f.ino, f.intFd(), status.String()) return written, status diff --git a/internal/fusefrontend/fs.go b/internal/fusefrontend/fs.go index 9e67a6a..d2465dd 100644 --- a/internal/fusefrontend/fs.go +++ b/internal/fusefrontend/fs.go @@ -116,7 +116,8 @@ func (fs *FS) Create(path string, flags uint32, mode uint32, context *fuse.Conte // Handle long file name cName := filepath.Base(cPath) if nametransform.IsLongContent(cName) { - dirfd, err := os.Open(filepath.Dir(cPath)) + var dirfd *os.File + dirfd, err = os.Open(filepath.Dir(cPath)) if err != nil { return nil, fuse.ToStatus(err) } @@ -129,7 +130,8 @@ func (fs *FS) Create(path string, flags uint32, mode uint32, context *fuse.Conte } // Create content - fdRaw, err := syscall.Openat(int(dirfd.Fd()), cName, iflags|os.O_CREATE, mode) + var fdRaw int + fdRaw, err = syscall.Openat(int(dirfd.Fd()), cName, iflags|os.O_CREATE, mode) if err != nil { nametransform.DeleteLongName(dirfd, cName) return nil, fuse.ToStatus(err) @@ -237,7 +239,8 @@ func (fs *FS) Readlink(path string, context *fuse.Context) (out string, status f } // Old filesystem: symlinks are encrypted like paths (CBC) if !fs.args.DirIV { - target, err := fs.decryptPath(cTarget) + var target string + target, err = fs.decryptPath(cTarget) if err != nil { toggledlog.Warn.Printf("Readlink: CBC decryption failed: %v", err) return "", fuse.EIO @@ -269,7 +272,8 @@ func (fs *FS) Unlink(path string, context *fuse.Context) (code fuse.Status) { cName := filepath.Base(cPath) if nametransform.IsLongContent(cName) { - dirfd, err := os.Open(filepath.Dir(cPath)) + var dirfd *os.File + dirfd, err = os.Open(filepath.Dir(cPath)) if err != nil { return fuse.ToStatus(err) } @@ -303,7 +307,8 @@ func (fs *FS) Symlink(target string, linkName string, context *fuse.Context) (co // Before v0.5, symlinks were encrypted like paths (CBC) // TODO drop compatibility and simplify code? if !fs.args.DirIV { - cTarget, err := fs.encryptPath(target) + var cTarget string + cTarget, err = fs.encryptPath(target) if err != nil { toggledlog.Warn.Printf("Symlink: BUG: we should not get an error here: %v", err) return fuse.ToStatus(err) @@ -318,7 +323,8 @@ func (fs *FS) Symlink(target string, linkName string, context *fuse.Context) (co // Handle long file name cName := filepath.Base(cPath) if nametransform.IsLongContent(cName) { - dirfd, err := os.Open(filepath.Dir(cPath)) + var dirfd *os.File + dirfd, err = os.Open(filepath.Dir(cPath)) if err != nil { return fuse.ToStatus(err) } diff --git a/internal/fusefrontend/fs_dir.go b/internal/fusefrontend/fs_dir.go index 41e2101..ed12d08 100644 --- a/internal/fusefrontend/fs_dir.go +++ b/internal/fusefrontend/fs_dir.go @@ -56,7 +56,8 @@ func (fs *FS) Mkdir(newPath string, mode uint32, context *fuse.Context) (code fu // Handle long file name cName := filepath.Base(cPath) if nametransform.IsLongContent(cName) { - dirfd, err := os.Open(filepath.Dir(cPath)) + var dirfd *os.File + dirfd, err = os.Open(filepath.Dir(cPath)) if err != nil { return fuse.ToStatus(err) } |