summaryrefslogtreecommitdiff
path: root/init_dir.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2022-01-03 15:18:59 +0100
committerJakob Unterwurzacher2022-01-03 15:18:59 +0100
commit4b251f3ce1f0a0472ed10a00aeef70c69ba03a5d (patch)
treea93b7b37d5b3118decd8a52f2db2e76d09d82b70 /init_dir.go
parent1eaf1211a259a38cdf3e7dad2e00e140409bef9a (diff)
readpassword: bubble up errors instead of exiting the process
This allows cleanups to happen in the caller, like removing the control socket. Fixes https://github.com/rfjakob/gocryptfs/issues/634
Diffstat (limited to 'init_dir.go')
-rw-r--r--init_dir.go6
1 files changed, 5 insertions, 1 deletions
diff --git a/init_dir.go b/init_dir.go
index 9658bab..5ade692 100644
--- a/init_dir.go
+++ b/init_dir.go
@@ -87,7 +87,11 @@ func initDir(args *argContainer) {
password = fido2.Secret(args.fido2, fido2CredentialID, fido2HmacSalt)
} else {
// normal password entry
- password = readpassword.Twice([]string(args.extpass), []string(args.passfile))
+ password, err = readpassword.Twice([]string(args.extpass), []string(args.passfile))
+ if err != nil {
+ tlog.Fatal.Println(err)
+ os.Exit(exitcodes.ReadPassword)
+ }
fido2CredentialID = nil
fido2HmacSalt = nil
}