main: init: refuse overwriting .gocryptfs.reverse.conf

This commit is contained in:
Jakob Unterwurzacher 2016-09-20 22:49:23 +02:00
parent 7f87ed78f2
commit 90f0bdc224
1 changed files with 7 additions and 1 deletions

View File

@ -18,7 +18,13 @@ import (
// not to be empty.
func initDir(args *argContainer) {
var err error
if !args.reverse {
if args.reverse {
_, err = os.Stat(args.config)
if err == nil {
tlog.Fatal.Printf("Config file %q already exists", args.config)
os.Exit(ERREXIT_INIT)
}
} else {
err = checkDirEmpty(args.cipherdir)
if err != nil {
tlog.Fatal.Printf("Invalid cipherdir: %v", err)