sync() after write to avoid losing file data on power off.

This commit is contained in:
Robin Davies
2024-09-01 09:53:32 -04:00
parent abb8a1a53c
commit b8c4fafd3a
21 changed files with 102 additions and 34 deletions
+2 -1
View File
@@ -30,6 +30,7 @@
#include <unistd.h>
#include <sys/stat.h>
#include <tuple>
#include "ofstream_synced.hpp"
using namespace pipedal;
@@ -65,7 +66,7 @@ void ServiceConfiguration::Save()
std::filesystem::create_directories(directory);
// make sure the file has correct permissions.
std::ofstream t;
pipedal::ofstream_synced t;
t.open(filename);
t.close();