diff options
| author | Joseph Richey <joerichey@google.com> | 2018-02-12 00:06:37 -0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-02-12 00:06:37 -0800 |
| commit | 57c646808e5f5077e60d004661bba4604650012b (patch) | |
| tree | 1ae1ed02acba2c9beef4a81652d5594c67cf60e6 | |
| parent | 3d99996924f2ee24581e8e557f3aa05ed7822e99 (diff) | |
| parent | 69630f37fcebe894b15872148bd8b2496806b60c (diff) | |
Merge pull request #87 from google/cleanup
Minor fixes and cleanup
| -rw-r--r-- | actions/protector.go | 4 | ||||
| -rw-r--r-- | cmd/fscrypt/commands.go | 8 | ||||
| -rw-r--r-- | cmd/fscrypt/strings.go | 2 | ||||
| -rw-r--r-- | crypto/key.go | 2 | ||||
| -rw-r--r-- | metadata/policy.go | 4 | ||||
| -rw-r--r-- | pam/pam.go | 2 | ||||
| -rw-r--r-- | pam_fscrypt/run_fscrypt.go | 2 |
7 files changed, 12 insertions, 12 deletions
diff --git a/actions/protector.go b/actions/protector.go index ffc3c43..fe5d694 100644 --- a/actions/protector.go +++ b/actions/protector.go @@ -123,7 +123,7 @@ func CreateProtector(ctx *Context, name string, keyFn KeyFunc) (*Protector, erro // UID for this kind of source. protector.data.Uid = int64(util.AtoiOrPanic(ctx.TargetUser.Uid)) // Make sure we aren't duplicating protectors - if err := checkIfUserHasLoginProtector(ctx, protector.data.Uid); err != nil { + if err = checkIfUserHasLoginProtector(ctx, protector.data.Uid); err != nil { return nil, err } fallthrough @@ -142,7 +142,7 @@ func CreateProtector(ctx *Context, name string, keyFn KeyFunc) (*Protector, erro } protector.data.ProtectorDescriptor = crypto.ComputeDescriptor(protector.key) - if err := protector.Rewrap(keyFn); err != nil { + if err = protector.Rewrap(keyFn); err != nil { protector.Lock() return nil, err } diff --git a/cmd/fscrypt/commands.go b/cmd/fscrypt/commands.go index 2f23a0f..66450c7 100644 --- a/cmd/fscrypt/commands.go +++ b/cmd/fscrypt/commands.go @@ -519,7 +519,7 @@ func createProtectorAction(c *cli.Context) error { } prompt := fmt.Sprintf("Create new protector on %q", ctx.Mount.Path) - if err := askConfirmation(prompt, true, ""); err != nil { + if err = askConfirmation(prompt, true, ""); err != nil { return newExitError(c, err) } @@ -561,20 +561,20 @@ func createPolicyAction(c *cli.Context) error { return newExitError(c, err) } - if err := checkRequiredFlags(c, []*stringFlag{protectorFlag}); err != nil { + if err = checkRequiredFlags(c, []*stringFlag{protectorFlag}); err != nil { return err } protector, err := getProtectorFromFlag(protectorFlag.Value, ctx.TargetUser) if err != nil { return newExitError(c, err) } - if err := protector.Unlock(existingKeyFn); err != nil { + if err = protector.Unlock(existingKeyFn); err != nil { return newExitError(c, err) } defer protector.Lock() prompt := fmt.Sprintf("Create new policy on %q", ctx.Mount.Path) - if err := askConfirmation(prompt, true, ""); err != nil { + if err = askConfirmation(prompt, true, ""); err != nil { return newExitError(c, err) } diff --git a/cmd/fscrypt/strings.go b/cmd/fscrypt/strings.go index fb79c38..c680d03 100644 --- a/cmd/fscrypt/strings.go +++ b/cmd/fscrypt/strings.go @@ -110,7 +110,7 @@ Options: {{if .Version}}Version: ` + indent + `{{.Version}} -{{end}}{{if .Compiled}}Compiled: +{{end}}{{if not .Compiled.IsZero}}Compiled: ` + indent + `{{.Compiled}} {{end}}{{if len .Authors}}Author{{with $length := len .Authors}}{{if ne 1 $length}}s{{end}}{{end}}:{{range .Authors}} diff --git a/crypto/key.go b/crypto/key.go index 9bf9098..027d46d 100644 --- a/crypto/key.go +++ b/crypto/key.go @@ -333,7 +333,7 @@ func ReadRecoveryCode(reader io.Reader) (*Key, error) { for blockStart := blockSize; blockStart < encodedLength; blockStart += blockSize { r.Read(inputSeparator) if r.Err() == nil && !bytes.Equal(separator, inputSeparator) { - err := errors.Wrapf(ErrRecoveryCode, "invalid separator %q", inputSeparator) + err = errors.Wrapf(ErrRecoveryCode, "invalid separator %q", inputSeparator) return nil, err } diff --git a/metadata/policy.go b/metadata/policy.go index 533d48a..ce40f9c 100644 --- a/metadata/policy.go +++ b/metadata/policy.go @@ -86,7 +86,7 @@ func GetPolicy(path string) (*PolicyData, error) { defer file.Close() var policy unix.FscryptPolicy - if err := policyIoctl(file, unix.FS_IOC_GET_ENCRYPTION_POLICY, &policy); err != nil { + if err = policyIoctl(file, unix.FS_IOC_GET_ENCRYPTION_POLICY, &policy); err != nil { return nil, errors.Wrapf(err, "get encryption policy %s", path) } @@ -119,7 +119,7 @@ func SetPolicy(path string, data *PolicyData) error { } defer file.Close() - if err := data.CheckValidity(); err != nil { + if err = data.CheckValidity(); err != nil { return errors.Wrap(err, "invalid policy") } @@ -58,7 +58,7 @@ func NewHandle(pamh unsafe.Pointer) (*Handle, error) { var pamUsername *C.char h.status = C.pam_get_user(h.handle, &pamUsername, nil) - if err := h.err(); err != nil { + if err = h.err(); err != nil { return nil, err } diff --git a/pam_fscrypt/run_fscrypt.go b/pam_fscrypt/run_fscrypt.go index 6414d99..da336df 100644 --- a/pam_fscrypt/run_fscrypt.go +++ b/pam_fscrypt/run_fscrypt.go @@ -199,7 +199,7 @@ func AdjustCount(handle *pam.Handle, delta int) (int, error) { if err != nil { return 0, err } - if err := unix.Flock(int(file.Fd()), unix.LOCK_EX); err != nil { + if err = unix.Flock(int(file.Fd()), unix.LOCK_EX); err != nil { return 0, err } defer file.Close() |