Backport #16435 Due to external locking on Windows it is possible for an os.Rename to fail if the files or directories are being used elsewhere. This PR simply suggests retrying the rename again similar to how we handle the os.Remove problems. Fix #16427 Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
parent
58615be523
commit
ca55e49cc0
8 changed files with 42 additions and 14 deletions
|
@ -834,7 +834,7 @@ func rewriteAllPublicKeys(e Engine) error {
|
|||
}
|
||||
|
||||
t.Close()
|
||||
return os.Rename(tmpPath, fPath)
|
||||
return util.Rename(tmpPath, fPath)
|
||||
}
|
||||
|
||||
// RegeneratePublicKeys regenerates the authorized_keys file
|
||||
|
@ -1316,7 +1316,7 @@ func rewriteAllPrincipalKeys(e Engine) error {
|
|||
}
|
||||
|
||||
t.Close()
|
||||
return os.Rename(tmpPath, fPath)
|
||||
return util.Rename(tmpPath, fPath)
|
||||
}
|
||||
|
||||
// ListPrincipalKeys returns a list of principals belongs to given user.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue