aboutsummaryrefslogtreecommitdiff
path: root/cmd/fscrypt/commands.go
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2025-02-17 14:41:29 -0800
committerEric Biggers <ebiggers@google.com>2025-02-17 14:47:54 -0800
commit57a749b308a07e26452a794533b4854d70212499 (patch)
treec0ebb1e62be273935a8acda3ffd6f98d4738581f /cmd/fscrypt/commands.go
parent8c4bd4c78b56422b90e759d891edd3a983d723f1 (diff)
Fix non-constant format string passed to errors.Wrapf()
Do not pass a path as the format string argument to errors.Wrapf(), as this causes it to be misinterpreted as a format string, causing an unexpected message if the path contains something like '%s'. Instead use errors.Wrap(). This was diagnosed by Go 1.24. Fixes https://github.com/google/fscrypt/issues/422
Diffstat (limited to 'cmd/fscrypt/commands.go')
-rw-r--r--cmd/fscrypt/commands.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd/fscrypt/commands.go b/cmd/fscrypt/commands.go
index 30aa3a7..3fc68a9 100644
--- a/cmd/fscrypt/commands.go
+++ b/cmd/fscrypt/commands.go
@@ -414,7 +414,7 @@ func unlockAction(c *cli.Context) error {
if policy.IsProvisionedByTargetUser() {
log.Printf("policy %s is already provisioned by %v",
policy.Descriptor(), ctx.TargetUser.Username)
- return newExitError(c, errors.Wrapf(ErrDirAlreadyUnlocked, path))
+ return newExitError(c, errors.Wrap(ErrDirAlreadyUnlocked, path))
}
if err := policy.Unlock(optionFn, existingKeyFn); err != nil {
@@ -521,7 +521,7 @@ func lockAction(c *cli.Context) error {
// locking the directory by dropping caches again.
if !policy.NeedsUserKeyring() || !isDirUnlockedHeuristic(path) {
log.Printf("policy %s is already fully deprovisioned", policy.Descriptor())
- return newExitError(c, errors.Wrapf(ErrDirAlreadyLocked, path))
+ return newExitError(c, errors.Wrap(ErrDirAlreadyLocked, path))
}
}