Write files in O_SYNC for fs backend to protect against machine crashes (#9434)

This commit is contained in:
Krishna Srinivas
2020-04-25 01:18:54 -07:00
committed by GitHub
parent 558785a4bb
commit 4843affd0e
2 changed files with 2 additions and 2 deletions

View File

@@ -25,7 +25,7 @@ import (
// AppendFile - appends the file "src" to the file "dst"
func AppendFile(dst string, src string) error {
appendFile, err := os.OpenFile(dst, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0666)
appendFile, err := os.OpenFile(dst, os.O_WRONLY|os.O_APPEND|os.O_CREATE|os.O_SYNC, 0666)
if err != nil {
return err
}