aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--integration_tests/performance_test.go3
-rw-r--r--internal/fusefrontend/file.go3
-rw-r--r--internal/fusefrontend/fs.go18
-rw-r--r--internal/fusefrontend/fs_dir.go3
-rw-r--r--main.go6
-rwxr-xr-xtest.bash2
6 files changed, 24 insertions, 11 deletions
diff --git a/integration_tests/performance_test.go b/integration_tests/performance_test.go
index 83bf207..9a0399a 100644
--- a/integration_tests/performance_test.go
+++ b/integration_tests/performance_test.go
@@ -45,7 +45,8 @@ func BenchmarkStreamRead(t *testing.B) {
if t.N > mb {
// Grow file so we can satisfy the test
//fmt.Printf("Growing file to %d MB... ", t.N)
- f2, err := os.OpenFile(fn, os.O_WRONLY|os.O_APPEND, 0666)
+ var f2 *os.File
+ f2, err = os.OpenFile(fn, os.O_WRONLY|os.O_APPEND, 0666)
if err != nil {
fmt.Println(err)
t.FailNow()
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)
}
diff --git a/main.go b/main.go
index ef93440..f7d53ae 100644
--- a/main.go
+++ b/main.go
@@ -224,7 +224,8 @@ func main() {
// "-cpuprofile"
if args.cpuprofile != "" {
toggledlog.Info.Printf("Writing CPU profile to %s", args.cpuprofile)
- f, err := os.Create(args.cpuprofile)
+ var f *os.File
+ f, err = os.Create(args.cpuprofile)
if err != nil {
fmt.Println(err)
os.Exit(ERREXIT_INIT)
@@ -235,7 +236,8 @@ func main() {
// "-memprofile"
if args.memprofile != "" {
toggledlog.Info.Printf("Writing mem profile to %s", args.memprofile)
- f, err := os.Create(args.memprofile)
+ var f *os.File
+ f, err = os.Create(args.memprofile)
if err != nil {
fmt.Println(err)
os.Exit(ERREXIT_INIT)
diff --git a/test.bash b/test.bash
index d4d26ae..c8f209a 100755
--- a/test.bash
+++ b/test.bash
@@ -7,3 +7,5 @@ cd "$(dirname "$0")"
source build.bash
go test ./... $*
+
+go tool vet -shadow=true .