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 . --- masterkey.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'masterkey.go') diff --git a/masterkey.go b/masterkey.go index d943745..3d7afd1 100644 --- a/masterkey.go +++ b/masterkey.go @@ -8,6 +8,7 @@ import ( "golang.org/x/crypto/ssh/terminal" "github.com/rfjakob/gocryptfs/internal/cryptocore" + "github.com/rfjakob/gocryptfs/internal/exitcodes" "github.com/rfjakob/gocryptfs/internal/tlog" ) @@ -50,11 +51,11 @@ func parseMasterKey(masterkey string) []byte { key, err := hex.DecodeString(masterkey) if err != nil { tlog.Fatal.Printf("Could not parse master key: %v", err) - os.Exit(1) + os.Exit(exitcodes.MasterKey) } if len(key) != cryptocore.KeyLen { tlog.Fatal.Printf("Master key has length %d but we require length %d", len(key), cryptocore.KeyLen) - os.Exit(1) + os.Exit(exitcodes.MasterKey) } tlog.Info.Printf("Using explicit master key.") tlog.Info.Printf(tlog.ColorYellow + -- cgit v1.2.3