summaryrefslogtreecommitdiff
path: root/mount.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2017-01-26 21:32:08 +0100
committerJakob Unterwurzacher2017-01-26 21:32:08 +0100
commit39eca53677abd0c397a884dd29ebc98ddfcbb270 (patch)
tree2127fecd309ada0ad3ac18ddd30584fa6c705b74 /mount.go
parenta7c7588deb2f256775667c986e1d85965dc2c3e6 (diff)
main: make sure the ctlsock file is deleted on incorrect password
Otherwise the next try to mount ends in "ctlsock: listen unix ctl.sock: bind: address already in use"
Diffstat (limited to 'mount.go')
-rw-r--r--mount.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/mount.go b/mount.go
index 3e93169..0d70201 100644
--- a/mount.go
+++ b/mount.go
@@ -88,7 +88,14 @@ func doMount(args *argContainer) int {
} else {
// Load master key from config file
// Prompts the user for the password
- masterkey, confFile = loadConfig(args)
+ masterkey, confFile, err = loadConfig(args)
+ if err != nil {
+ if args._ctlsockFd != nil {
+ // Close the socket file (which also deletes it)
+ args._ctlsockFd.Close()
+ }
+ os.Exit(ErrExitLoadConf)
+ }
printMasterKey(masterkey)
}
// We cannot use JSON for pretty-printing as the fields are unexported