fix rename failed when rewrite public keys (#7761)

tokarchuk/v1.17
Lunny Xiao 5 years ago committed by GitHub
parent 2594693a46
commit 4328d8e8d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      models/ssh_key.go

@ -685,12 +685,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)
} }

Loading…
Cancel
Save