mirror of
https://blitiri.com.ar/repos/chasquid
synced 2025-12-17 14:37:02 +00:00
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.
This commit is contained in:
@@ -100,7 +100,10 @@ func userDBFromArgs(create bool) (string, string, *userdb.DB) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
if create && os.IsNotExist(err) {
|
if create && os.IsNotExist(err) {
|
||||||
fmt.Println("Creating database")
|
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 {
|
} else {
|
||||||
Fatalf("Error loading database: %v", err)
|
Fatalf("Error loading database: %v", err)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user