summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2015-12-06 14:24:45 +0100
committerJakob Unterwurzacher2015-12-06 14:24:45 +0100
commit71b94828edb00d3a86bbe366f49295d81f91c28c (patch)
tree502a8a770ae57629947a4a23179f17553a0def6a /main.go
parentfc23aba65b061fab65aa7040c8928c63b3f04310 (diff)
init: create gocryptfs.diriv after creating gocryptfs.conf
Creating the config file can fail easily, for example if the password is not entered the same twice. This would leave an orphaned gocryptfs.diriv behind.
Diffstat (limited to 'main.go')
-rw-r--r--main.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/main.go b/main.go
index c5c7f64..9da89ab 100644
--- a/main.go
+++ b/main.go
@@ -52,21 +52,22 @@ func initDir(args *argContainer) {
os.Exit(ERREXIT_INIT)
}
- // Create gocryptfs.diriv in the root dir
- err = cryptfs.WriteDirIV(args.cipherdir)
+ // Create gocryptfs.conf
+ cryptfs.Info.Printf("Choose a password for protecting your files.\n")
+ password := readPasswordTwice(args.extpass)
+ err = cryptfs.CreateConfFile(args.config, password, args.plaintextnames, args.scryptn)
if err != nil {
fmt.Println(err)
os.Exit(ERREXIT_INIT)
}
- // Create gocryptfs.conf
- cryptfs.Info.Printf("Choose a password for protecting your files.\n")
- password := readPasswordTwice(args.extpass)
- err = cryptfs.CreateConfFile(args.config, password, args.plaintextnames, args.scryptn)
+ // Create gocryptfs.diriv in the root dir
+ err = cryptfs.WriteDirIV(args.cipherdir)
if err != nil {
fmt.Println(err)
os.Exit(ERREXIT_INIT)
}
+
cryptfs.Info.Printf("The filesystem is now ready for mounting.\n")
os.Exit(0)
}