aboutsummaryrefslogtreecommitdiff
path: root/init_dir.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2016-09-20 22:49:23 +0200
committerJakob Unterwurzacher2016-09-25 16:43:17 +0200
commit90f0bdc2241290d9d495b606abaec2e973383b80 (patch)
treeee3f98f5fd911ad5755d5bcce8326d927fd294ed /init_dir.go
parent7f87ed78f2f27831f2fa9409106846e3288c6f6e (diff)
main: init: refuse overwriting .gocryptfs.reverse.conf
Diffstat (limited to 'init_dir.go')
-rw-r--r--init_dir.go8
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)