mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-10 09:09:02 +00:00
[GITEA] Make atomic ssh keys replacement robust
- After stumbling upon https://github.com/golang/go/issues/22397 and reading the implementations I realized that Forgejo code doesn't have `Sync()` and it doesn't properly error handle the `Close` function. - (likely) Resolves https://codeberg.org/forgejo/forgejo/issues/1446 (cherry picked from commit0efcb334c2
) (cherry picked from commit04ef02c0dd
) (cherry picked from commit85f2065c9b
) (cherry picked from commit8d36b5cce6
) (cherry picked from commit378dc30fb5
) (cherry picked from commit2b28bf826e
) (cherry picked from commitd0625a001e
) (cherry picked from commitf161a4f60f
) (cherry picked from commit7430ca43e5
) (cherry picked from commitab6d38daf7
) (cherry picked from commit0f703fd02e
) (cherry picked from commit6931a8f6bb
) (cherry picked from commit5e2065c1c0
) (cherry picked from commit38c812acff
) (cherry picked from commit494874e23f
) (cherry picked from commitd396b7fd47
) (cherry picked from commit7babc6efe1
) (cherry picked from commit2d4dbbe741
)
This commit is contained in:
parent
fa37a211fb
commit
b896a87103
|
@ -169,7 +169,12 @@ func RewriteAllPublicKeys(ctx context.Context) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Close()
|
if err := t.Sync(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := t.Close(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
return util.Rename(tmpPath, fPath)
|
return util.Rename(tmpPath, fPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,12 @@ func RewriteAllPrincipalKeys(ctx context.Context) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Close()
|
if err := t.Sync(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := t.Close(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
return util.Rename(tmpPath, fPath)
|
return util.Rename(tmpPath, fPath)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue