exitcodes: add code 22 for "password is empty"
Empty passwords are not allowed. Let's give the error it's own exit code.
This commit is contained in:
parent
8aabc54276
commit
2aea2d3d62
@ -14,7 +14,8 @@ const (
|
|||||||
// 3 is reserved because it was used by earlier gocryptfs version as a generic
|
// 3 is reserved because it was used by earlier gocryptfs version as a generic
|
||||||
// "mount" error.
|
// "mount" error.
|
||||||
|
|
||||||
// CipherDir means that the CIPHERDIR does not exist
|
// CipherDir means that the CIPHERDIR does not exist, is not empty, or is not
|
||||||
|
// a directory.
|
||||||
CipherDir = 6
|
CipherDir = 6
|
||||||
// Init is an error on filesystem init
|
// Init is an error on filesystem init
|
||||||
Init = 7
|
Init = 7
|
||||||
@ -50,6 +51,8 @@ const (
|
|||||||
CtlSock = 20
|
CtlSock = 20
|
||||||
// PanicLogCreate - there was a problem creating the /tmp/gocryptfs_paniclog.XYZ file.
|
// PanicLogCreate - there was a problem creating the /tmp/gocryptfs_paniclog.XYZ file.
|
||||||
PanicLogCreate = 21
|
PanicLogCreate = 21
|
||||||
|
// PasswordEmpty - we received an empty password
|
||||||
|
PasswordEmpty = 22
|
||||||
)
|
)
|
||||||
|
|
||||||
// Err wraps an error with an associated numeric exit code
|
// Err wraps an error with an associated numeric exit code
|
||||||
|
@ -65,7 +65,7 @@ func readPasswordTerminal(prompt string) string {
|
|||||||
fmt.Fprintf(os.Stderr, "\n")
|
fmt.Fprintf(os.Stderr, "\n")
|
||||||
if len(p) == 0 {
|
if len(p) == 0 {
|
||||||
tlog.Fatal.Println("Password is empty")
|
tlog.Fatal.Println("Password is empty")
|
||||||
os.Exit(exitcodes.ReadPassword)
|
os.Exit(exitcodes.PasswordEmpty)
|
||||||
}
|
}
|
||||||
return string(p)
|
return string(p)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user