From d5adde1eeb13ba377f7c05b9f21893c01f61ec16 Mon Sep 17 00:00:00 2001 From: Jakob Unterwurzacher Date: Sun, 7 May 2017 22:15:01 +0200 Subject: exitcodes: pull all exit code definitions into the package This commit defines all exit codes in one place in the exitcodes package. Also, it adds a test to verify the exit code on incorrect password, which is what SiriKali cares about the most. Fixes https://github.com/rfjakob/gocryptfs/issues/77 . --- internal/exitcodes/exitcodes.go | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) (limited to 'internal/exitcodes/exitcodes.go') diff --git a/internal/exitcodes/exitcodes.go b/internal/exitcodes/exitcodes.go index 2ec3ae6..7a2efdb 100644 --- a/internal/exitcodes/exitcodes.go +++ b/internal/exitcodes/exitcodes.go @@ -8,12 +8,39 @@ import ( ) const ( + // Usage error: cli syntax etc + Usage = 1 + // 2 is reserved because it is used by Go panic + + // Mount is an error on mount + Mount = 3 + // CipherDir means that the CIPHERDIR does not exist + CipherDir = 6 + // Init is an error on filesystem init + Init = 7 + // LoadConf is an error while loading gocryptfs.conf + LoadConf = 8 + // ReadPassword means something went wrong reading the password + ReadPassword = 9 + // MountPoint error means that the mountpoint is invalid (not empty etc). + MountPoint = 10 // Other error - please inspect the message Other = 11 // PasswordIncorrect - the password was incorrect PasswordIncorrect = 12 - // TODO several other exit codes are defined in main.go. These will be - // ported over here. + // ScryptParams means that scrypt was called with invalid parameters + ScryptParams = 13 + // MasterKey means that something went wrong when parsing the "-masterkey" + // command line option + MasterKey = 14 + // SigInt means we got SIGINT + SigInt = 15 + // PanicLog means the panic log was not empty when we were unmounted + PanicLog = 16 + // ForkChild means forking the worker child failed + ForkChild = 17 + // OpenSSL means you tried to enable OpenSSL, but we were compiled without it. + OpenSSL = 18 ) // Err wraps an error with an associated numeric exit code -- cgit v1.2.3