From 15b79d9de98ae6828a3615b397d75e5dadcf46f1 Mon Sep 17 00:00:00 2001 From: Alberto Bertogli Date: Mon, 13 Apr 2020 14:43:51 +0100 Subject: [PATCH] chasquid-util: Check that we can create the database directory When creating a database directory, we were missing the check to see if it had succeeded, which would make issues more difficult to troubleshoot. This patch adds the missing check. --- cmd/chasquid-util/chasquid-util.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/cmd/chasquid-util/chasquid-util.go b/cmd/chasquid-util/chasquid-util.go index ab5eb7c..bc2e707 100644 --- a/cmd/chasquid-util/chasquid-util.go +++ b/cmd/chasquid-util/chasquid-util.go @@ -100,7 +100,10 @@ func userDBFromArgs(create bool) (string, string, *userdb.DB) { if err != nil { if create && os.IsNotExist(err) { fmt.Println("Creating database") - os.MkdirAll(filepath.Dir(userDBForDomain(domain)), 0755) + err = os.MkdirAll(filepath.Dir(userDBForDomain(domain)), 0755) + if err != nil { + Fatalf("Error creating database dir: %v", err) + } } else { Fatalf("Error loading database: %v", err) }