diff options
Diffstat (limited to 'internal')
| -rw-r--r-- | internal/contentenc/bpool.go | 1 | ||||
| -rw-r--r-- | internal/ctlsocksrv/ctlsock_serve.go | 4 | ||||
| -rw-r--r-- | internal/exitcodes/exitcodes.go | 4 | ||||
| -rw-r--r-- | internal/fusefrontend/xattr_unit_test.go | 6 | ||||
| -rw-r--r-- | internal/fusefrontend_reverse/node_helpers.go | 1 | ||||
| -rw-r--r-- | internal/readpassword/read.go | 10 | ||||
| -rw-r--r-- | internal/siv_aead/correctness_test.go | 4 | ||||
| -rw-r--r-- | internal/syscallcompat/sys_linux.go | 12 | 
8 files changed, 25 insertions, 17 deletions
| diff --git a/internal/contentenc/bpool.go b/internal/contentenc/bpool.go index c4517d3..c62170d 100644 --- a/internal/contentenc/bpool.go +++ b/internal/contentenc/bpool.go @@ -26,6 +26,7 @@ func (b *bPool) Put(s []byte) {  	if len(s) != b.sliceLen {  		log.Panicf("wrong len=%d, want=%d", len(s), b.sliceLen)  	} +	//lint:ignore SA6002 We intentionally pass slice by value to avoid allocation overhead in this specific use case  	b.Pool.Put(s)  } diff --git a/internal/ctlsocksrv/ctlsock_serve.go b/internal/ctlsocksrv/ctlsock_serve.go index 85f5b65..25d1e44 100644 --- a/internal/ctlsocksrv/ctlsock_serve.go +++ b/internal/ctlsocksrv/ctlsock_serve.go @@ -101,7 +101,7 @@ func (ch *ctlSockHandler) handleRequest(in *ctlsock.RequestStruct, conn *net.Uni  	}  	// Neither encryption nor encryption has been requested, makes no sense  	if in.DecryptPath == "" && in.EncryptPath == "" { -		err = errors.New("Empty input") +		err = errors.New("empty input")  		sendResponse(conn, err, "", "")  		return  	} @@ -118,7 +118,7 @@ func (ch *ctlSockHandler) handleRequest(in *ctlsock.RequestStruct, conn *net.Uni  	}  	// Error out if the canonical path is now empty  	if clean == "" { -		err = errors.New("Empty input after canonicalization") +		err = errors.New("empty input after canonicalization")  		sendResponse(conn, err, "", warnText)  		return  	} diff --git a/internal/exitcodes/exitcodes.go b/internal/exitcodes/exitcodes.go index 508ba38..881afda 100644 --- a/internal/exitcodes/exitcodes.go +++ b/internal/exitcodes/exitcodes.go @@ -3,7 +3,7 @@  package exitcodes  import ( -	"fmt" +	"errors"  	"os"  ) @@ -83,7 +83,7 @@ type Err struct {  // NewErr returns an error containing "msg" and the exit code "code".  func NewErr(msg string, code int) Err {  	return Err{ -		error: fmt.Errorf(msg), +		error: errors.New(msg),  		code:  code,  	}  } diff --git a/internal/fusefrontend/xattr_unit_test.go b/internal/fusefrontend/xattr_unit_test.go index 86c87a7..7d8e32e 100644 --- a/internal/fusefrontend/xattr_unit_test.go +++ b/internal/fusefrontend/xattr_unit_test.go @@ -21,10 +21,10 @@ func newTestFS(args Args) *RootNode {  	cEnc := contentenc.New(cCore, contentenc.DefaultBS)  	n := nametransform.New(cCore.EMECipher, true, 0, true, nil, false)  	rn := NewRootNode(args, cEnc, n) -	oneSec := time.Second +	oneSecond := time.Second  	options := &fs.Options{ -		EntryTimeout: &oneSec, -		AttrTimeout:  &oneSec, +		EntryTimeout: &oneSecond, +		AttrTimeout:  &oneSecond,  	}  	fs.NewNodeFS(rn, options)  	return rn diff --git a/internal/fusefrontend_reverse/node_helpers.go b/internal/fusefrontend_reverse/node_helpers.go index 898587b..3165db6 100644 --- a/internal/fusefrontend_reverse/node_helpers.go +++ b/internal/fusefrontend_reverse/node_helpers.go @@ -24,7 +24,6 @@ const (  	// * base64(192 bytes) = 256 bytes (over 255!)  	// But the PKCS#7 padding is at least one byte. This means we can only use  	// 175 bytes for the file name. -	shortNameMax = 175  )  // translateSize translates the ciphertext size in `out` into plaintext size. diff --git a/internal/readpassword/read.go b/internal/readpassword/read.go index 582a104..9193ae8 100644 --- a/internal/readpassword/read.go +++ b/internal/readpassword/read.go @@ -58,7 +58,7 @@ func Twice(extpass []string, passfile []string) ([]byte, error) {  		return nil, err  	}  	if !bytes.Equal(p1, p2) { -		return nil, fmt.Errorf("Passwords do not match") +		return nil, fmt.Errorf("passwords do not match")  	}  	// Wipe the password duplicate from memory  	for i := range p2 { @@ -71,15 +71,15 @@ func Twice(extpass []string, passfile []string) ([]byte, error) {  // Exits on read error or empty result.  func readPasswordTerminal(prompt string) ([]byte, error) {  	fd := int(os.Stdin.Fd()) -	fmt.Fprintf(os.Stderr, prompt) +	fmt.Fprint(os.Stderr, prompt)  	// term.ReadPassword removes the trailing newline  	p, err := term.ReadPassword(fd)  	if err != nil { -		return nil, fmt.Errorf("Could not read password from terminal: %v\n", err) +		return nil, fmt.Errorf("could not read password from terminal: %v", err)  	}  	fmt.Fprintf(os.Stderr, "\n")  	if len(p) == 0 { -		return nil, fmt.Errorf("Password is empty") +		return nil, fmt.Errorf("password is empty")  	}  	return p, nil  } @@ -100,7 +100,7 @@ func readPasswordStdin(prompt string) ([]byte, error) {  		return nil, err  	}  	if len(p) == 0 { -		return nil, fmt.Errorf("Got empty %s from stdin", prompt) +		return nil, fmt.Errorf("got empty %s from stdin", prompt)  	}  	return p, nil  } diff --git a/internal/siv_aead/correctness_test.go b/internal/siv_aead/correctness_test.go index 0653e26..7be97bc 100644 --- a/internal/siv_aead/correctness_test.go +++ b/internal/siv_aead/correctness_test.go @@ -50,7 +50,7 @@ func TestK32(t *testing.T) {  	expectedResult, _ := hex.DecodeString(  		"02020202020202020202020202020202ad7a4010649a84d8c1dd5f752e935eed57d45b8b10008f3834")  	if !bytes.Equal(aResult, expectedResult) { -		t.Errorf(hex.EncodeToString(aResult)) +		t.Error(hex.EncodeToString(aResult))  	}  	// Verify overhead  	overhead := len(aResult) - len(plaintext) - len(nonce) @@ -108,7 +108,7 @@ func TestK64(t *testing.T) {  	expectedResult, _ := hex.DecodeString(  		"02020202020202020202020202020202317b316f67c3ad336c01c9a01b4c5e552ba89e966bc4c1ade1")  	if !bytes.Equal(aResult, expectedResult) { -		t.Errorf(hex.EncodeToString(aResult)) +		t.Error(hex.EncodeToString(aResult))  	}  	// Verify overhead  	overhead := len(aResult) - len(plaintext) - len(nonce) diff --git a/internal/syscallcompat/sys_linux.go b/internal/syscallcompat/sys_linux.go index 5a4a4ab..19d2c56 100644 --- a/internal/syscallcompat/sys_linux.go +++ b/internal/syscallcompat/sys_linux.go @@ -124,8 +124,16 @@ func LsetxattrUser(path string, attr string, data []byte, flags int, context *fu  func timesToTimespec(a *time.Time, m *time.Time) []unix.Timespec {  	ts := make([]unix.Timespec, 2) -	ts[0] = unix.Timespec(fuse.UtimeToTimespec(a)) -	ts[1] = unix.Timespec(fuse.UtimeToTimespec(m)) +	if a == nil { +		ts[0] = unix.Timespec{Nsec: unix.UTIME_OMIT} +	} else { +		ts[0], _ = unix.TimeToTimespec(*a) +	} +	if m == nil { +		ts[1] = unix.Timespec{Nsec: unix.UTIME_OMIT} +	} else { +		ts[1], _ = unix.TimeToTimespec(*m) +	}  	return ts  } | 
