mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-17 14:37:02 +00:00
chasquid-util: Create the domain directory when adding a user
When adding a user, chasquid-util should create the domain directory if it doesn't exist, but currently doesn't do that. This patch fixes this by adding the missing os.MkdirAll call. Thanks to Martin Ferrari for the bug report!
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"syscall"
|
||||
|
||||
"bytes"
|
||||
@@ -86,6 +87,7 @@ 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)
|
||||
} else {
|
||||
Fatalf("Error loading database: %v", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user