refactor: check the error returned by os.MkdirAll()

release/v1.15
Bo-Yi Wu 2017-01-09 22:36:23 +08:00
parent 97170916a3
commit f91b8c5f53
1 changed files with 3 additions and 1 deletions

View File

@ -660,7 +660,9 @@ please consider changing to GITEA_CUSTOM`)
cfg.Section("server").Key("LFS_JWT_SECRET").SetValue(LFS.JWTSecretBase64)
os.MkdirAll(filepath.Dir(CustomConf), os.ModePerm)
if err := os.MkdirAll(filepath.Dir(CustomConf), os.ModePerm); err != nil {
log.Fatal(4, "Fail to create '%s': %v", CustomConf, err)
}
if err := cfg.SaveTo(CustomConf); err != nil {
log.Fatal(4, "Error saving generated JWT Secret to custom config: %v", err)
return