aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSmallJoker <mk939@ymail.com>2014-12-06 17:26:22 +0100
committerkwolekr <kwolekr@minetest.net>2014-12-06 14:08:01 -0500
commitd75f0b0360daeb81dd574756845160745dfecacd (patch)
tree1103e2bee4508b3178abf22f37d2c4fa2221a7f1 /src
parent4fcf9fb66a54d0f72b7338a2668b04236e69cc16 (diff)
downloadminetest-d75f0b0360daeb81dd574756845160745dfecacd.tar.gz
minetest-d75f0b0360daeb81dd574756845160745dfecacd.tar.bz2
minetest-d75f0b0360daeb81dd574756845160745dfecacd.zip
Close settings files and save them correctly
Diffstat (limited to 'src')
-rw-r--r--src/settings.cpp7
1 files changed, 5 insertions, 2 deletions
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())) {