mirror of
https://github.com/zeek/zeek.git
synced 2025-10-08 01:28:20 +00:00
Merge branch 'fsync-shadow-files-before-rename' of https://github.com/awelzel/zeek
* 'fsync-shadow-files-before-rename' of https://github.com/awelzel/zeek: logging/writers/ascii: shadow files: Add fsync() before rename()
This commit is contained in:
commit
1b3b9a3cfc
5 changed files with 45 additions and 3 deletions
|
@ -465,7 +465,7 @@ bool Ascii::DoInit(const WriterInfo& info, int num_fields, const threading::Fiel
|
|||
|
||||
if ( sfd < 0 )
|
||||
{
|
||||
Error(Fmt("cannot open %s: %s", sfname.data(), Strerror(errno)));
|
||||
Error(Fmt("cannot open %s: %s", tmp_sfname.data(), Strerror(errno)));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -478,7 +478,7 @@ bool Ascii::DoInit(const WriterInfo& info, int num_fields, const threading::Fiel
|
|||
util::safe_write(sfd, ppf, strlen(ppf));
|
||||
|
||||
util::safe_write(sfd, "\n", 1);
|
||||
|
||||
util::safe_fsync(sfd);
|
||||
util::safe_close(sfd);
|
||||
|
||||
if ( rename(tmp_sfname.data(), sfname.data()) == -1 )
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue