diff options
author | Jakob Unterwurzacher | 2016-09-20 22:49:23 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2016-09-25 16:43:17 +0200 |
commit | 90f0bdc2241290d9d495b606abaec2e973383b80 (patch) | |
tree | ee3f98f5fd911ad5755d5bcce8326d927fd294ed | |
parent | 7f87ed78f2f27831f2fa9409106846e3288c6f6e (diff) |
main: init: refuse overwriting .gocryptfs.reverse.conf
-rw-r--r-- | init_dir.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/init_dir.go b/init_dir.go index 2642dd2..c52e2fa 100644 --- a/init_dir.go +++ b/init_dir.go @@ -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) |