From: SmallJoker Date: Sat, 6 Dec 2014 16:26:22 +0000 (+0100) Subject: Close settings files and save them correctly X-Git-Tag: 0.4.11~96 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=d75f0b0360daeb81dd574756845160745dfecacd;p=oweals%2Fminetest.git Close settings files and save them correctly --- diff --git a/src/settings.cpp b/src/settings.cpp index 775c00699..fa7da806d 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -350,8 +350,11 @@ bool Settings::updateConfigFile(const char *filename) std::ifstream is(filename); std::ostringstream os(std::ios_base::binary); - - if (!updateConfigObject(is, os, "")) + + bool was_modified = updateConfigObject(is, os, ""); + is.close(); + + if (!was_modified) return true; if (!fs::safeWriteToFile(filename, os.str())) {