aboutsummaryrefslogtreecommitdiffstats
path: root/models/ssh_key.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2019-08-06 14:32:11 +0800
committerGitHub <noreply@github.com>2019-08-06 14:32:11 +0800
commit4328d8e8d72c49ee92566f1e6b17edf177004cc7 (patch)
treee31bd8109c418d6ae953c6e946093b3a972ab7bb /models/ssh_key.go
parent2594693a46e701180c2bd8505d8b84986fad927d (diff)
downloadgitea-4328d8e8d72c49ee92566f1e6b17edf177004cc7.tar.gz
gitea-4328d8e8d72c49ee92566f1e6b17edf177004cc7.zip
fix rename failed when rewrite public keys (#7761)
Diffstat (limited to 'models/ssh_key.go')
-rw-r--r--models/ssh_key.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/models/ssh_key.go b/models/ssh_key.go
index b2a905305a..4f93b5c44f 100644
--- a/models/ssh_key.go
+++ b/models/ssh_key.go
@@ -685,12 +685,14 @@ func rewriteAllPublicKeys(e Engine) error {
}
_, err = t.WriteString(line + "\n")
if err != nil {
+ f.Close()
return err
}
}
- defer f.Close()
+ f.Close()
}
+ t.Close()
return os.Rename(tmpPath, fPath)
}