make sure file is written before we check it's state

This commit is contained in:
Green Sky
2025-08-01 16:59:50 +02:00
parent 8fb6f40709
commit d63ae90332

View File

@@ -227,6 +227,8 @@ void ToxClient::saveToxProfile(void) {
try {
std::ofstream ofile{tmp_path, std::ios::binary};
ofile.write(reinterpret_cast<const char*>(data.data()), data.size());
ofile.flush();
if (!ofile.good()) {
// TODO: maybe enable fstream exceptions instead?
throw std::runtime_error("write error");