summaryrefslogtreecommitdiffstats
path: root/models/ssh_key.go
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2021-07-15 16:46:07 +0100
committerGitHub <noreply@github.com>2021-07-15 11:46:07 -0400
commit33a8eec33e975a74f1718a83e99eb6abc7662a19 (patch)
treed000ff3f37d417e9d03d15d070ed6fecf9c56636 /models/ssh_key.go
parentaed086f8b021f5724ff1449ceb9f44dc28749a97 (diff)
downloadgitea-33a8eec33e975a74f1718a83e99eb6abc7662a19.tar.gz
gitea-33a8eec33e975a74f1718a83e99eb6abc7662a19.zip
Retry rename on lock induced failures (#16435)
* Retry rename on lock induced failures 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> * resolve CI fail Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'models/ssh_key.go')
-rw-r--r--models/ssh_key.go4
1 files changed, 2 insertions, 2 deletions
diff --git a/models/ssh_key.go b/models/ssh_key.go
index e35fc12e08..12c7bc9116 100644
--- a/models/ssh_key.go
+++ b/models/ssh_key.go
@@ -842,7 +842,7 @@ func rewriteAllPublicKeys(e Engine) error {
}
t.Close()
- return os.Rename(tmpPath, fPath)
+ return util.Rename(tmpPath, fPath)
}
// RegeneratePublicKeys regenerates the authorized_keys file
@@ -1324,7 +1324,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.