1
1
mirror of https://github.com/go-gitea/gitea synced 2024-12-25 18:14:28 +00:00

fix rename failed when rewrite public keys (#7761) (#7769)

This commit is contained in:
Lunny Xiao 2019-08-06 15:41:26 +08:00 committed by GitHub
parent 1b5908fb6a
commit aea49d0b92
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -642,12 +642,14 @@ func rewriteAllPublicKeys(e Engine) error {
} }
_, err = t.WriteString(line + "\n") _, err = t.WriteString(line + "\n")
if err != nil { if err != nil {
f.Close()
return err return err
} }
} }
defer f.Close() f.Close()
} }
t.Close()
return os.Rename(tmpPath, fPath) return os.Rename(tmpPath, fPath)
} }