From d63ae9033225e27575d6a2212f35c460596d04aa Mon Sep 17 00:00:00 2001 From: Green Sky Date: Fri, 1 Aug 2025 16:59:50 +0200 Subject: [PATCH] make sure file is written before we check it's state --- src/tox_client.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tox_client.cpp b/src/tox_client.cpp index 3dc9cfe..e602e34 100644 --- a/src/tox_client.cpp +++ b/src/tox_client.cpp @@ -227,6 +227,8 @@ void ToxClient::saveToxProfile(void) { try { std::ofstream ofile{tmp_path, std::ios::binary}; ofile.write(reinterpret_cast(data.data()), data.size()); + ofile.flush(); + if (!ofile.good()) { // TODO: maybe enable fstream exceptions instead? throw std::runtime_error("write error");