Skip to content

Commit

Permalink
Add fsync for file writing
Browse files Browse the repository at this point in the history
  • Loading branch information
bugdea1er committed Jan 18, 2025
1 parent 8d2b445 commit 0f6bd65
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ void write(entry::native_handle_type handle, std::string_view content,

content = content.substr(written);
} while (!content.empty());

#ifndef _WIN32
if (fsync(handle) == -1) {
ec = std::error_code(errno, std::system_category());
}
#endif
ec.clear();
}
} // namespace
Expand Down

0 comments on commit 0f6bd65

Please sign in to comment.