Skip to content

Commit

Permalink
Add flush() for nfprofile
Browse files Browse the repository at this point in the history
  • Loading branch information
phaag committed May 8, 2023
1 parent 399014d commit d90d561
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/lib/nffile.c
Original file line number Diff line number Diff line change
Expand Up @@ -880,6 +880,7 @@ static void FlushFile(nffile_t *nffile) {
}
nffile->worker = 0;
}
fsync(nffile->fd);

} // End of FlushFile

Expand Down Expand Up @@ -939,6 +940,13 @@ int CloseUpdateFile(nffile_t *nffile) {
FreeDataBlock(nffile->block_header);
nffile->block_header = NULL;
}

if (lseek(nffile->fd, 0, SEEK_END) < 0) {
LogError("lseek() error in %s line %d: %s", __FILE__, __LINE__, strerror(errno));
close(nffile->fd);
return 0;
}
fsync(nffile->fd);
CloseFile(nffile);

return 1;
Expand Down

0 comments on commit d90d561

Please sign in to comment.