Commit 15b79d9d authored by Alberto Bertogli's avatar Alberto Bertogli

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.
parent 929a9947
......@@ -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)
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment