Skip to content

Commit

Permalink
Cherry-pick #9069 to 6.5: Propagate Sync error when running SafeFileR…
Browse files Browse the repository at this point in the history
…otate (#9142)

* Propagate Sync error when running SafeFileRotate (#9069)

Previously, it was possible SafeFileRotate encountered an error without propagating it, because the return value of os.Sync was not utilized.
From now on the errors from Sync are propagated.
(cherry picked from commit 93eb92a)
  • Loading branch information
kvch authored Nov 21, 2018
1 parent 7aaa0f2 commit 57d85d6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ https://github.com/elastic/beats/compare/v6.5.1...6.5[Check the HEAD diff]

*Affecting all Beats*

- Propagate Sync error when running SafeFileRotate. {pull}9069[9069]

*Auditbeat*

*Filebeat*
Expand Down
3 changes: 1 addition & 2 deletions libbeat/common/file/helper_other.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ func SafeFileRotate(path, tempfile string) error {
return nil // ignore error
}
defer f.Close()
f.Sync()

return nil
return f.Sync()
}

0 comments on commit 57d85d6

Please sign in to comment.