summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Unterwurzacher2018-04-01 12:12:47 +0200
committerJakob Unterwurzacher2018-04-01 12:13:32 +0200
commit5da5e467a6c92a658b00e2f6a94ed03a6fcd3bf0 (patch)
treec321fa8fa42a19c17dd477c9b5d10a3732e22a93
parent1a3d04ab87c0f8ea281f47547f3cfeda50c7609a (diff)
main: pull regular exits into main function
The replaces the "does not return" comments with an explicit os.Exit, which is unambigous.
-rw-r--r--info.go1
-rw-r--r--init_dir.go1
-rw-r--r--main.go10
3 files changed, 6 insertions, 6 deletions
diff --git a/info.go b/info.go
index b6f041f..bbc5a10 100644
--- a/info.go
+++ b/info.go
@@ -41,5 +41,4 @@ func info(filename string) {
s := cf.ScryptObject
fmt.Printf("ScryptObject: Salt=%dB N=%d R=%d P=%d KeyLen=%d\n",
len(s.Salt), s.N, s.R, s.P, s.KeyLen)
- os.Exit(0)
}
diff --git a/init_dir.go b/init_dir.go
index ea902ec..16ece1a 100644
--- a/init_dir.go
+++ b/init_dir.go
@@ -79,5 +79,4 @@ func initDir(args *argContainer) {
}
tlog.Info.Printf(tlog.ColorGrey+"You can now mount it using: %s%s %s MOUNTPOINT"+tlog.ColorReset,
tlog.ProgramName, mountArgs, friendlyPath)
- os.Exit(0)
}
diff --git a/main.go b/main.go
index 8f857bc..e8d2364 100644
--- a/main.go
+++ b/main.go
@@ -103,7 +103,6 @@ func changePassword(args *argContainer) {
os.Exit(exitcodes.WriteConf)
}
tlog.Info.Printf(tlog.ColorGreen + "Password changed." + tlog.ColorReset)
- os.Exit(0)
}
// printVersion prints a version string like this:
@@ -257,7 +256,8 @@ func main() {
tlog.Fatal.Printf("Usage: %s -info CIPHERDIR", tlog.ProgramName)
os.Exit(exitcodes.Usage)
}
- info(args.config) // does not return
+ info(args.config)
+ os.Exit(0)
}
// "-init"
if args.init {
@@ -265,7 +265,8 @@ func main() {
tlog.Fatal.Printf("Usage: %s -init [OPTIONS] CIPHERDIR", tlog.ProgramName)
os.Exit(exitcodes.Usage)
}
- initDir(&args) // does not return
+ initDir(&args)
+ os.Exit(0)
}
// "-passwd"
if args.passwd {
@@ -273,7 +274,8 @@ func main() {
tlog.Fatal.Printf("Usage: %s -passwd [OPTIONS] CIPHERDIR", tlog.ProgramName)
os.Exit(exitcodes.Usage)
}
- changePassword(&args) // does not return
+ changePassword(&args)
+ os.Exit(0)
}
// Default operation: mount.
if flagSet.NArg() != 2 {