aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2.cpp
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2015-12-31 12:43:15 +0200
committerRiccardo Spagni <ric@spagni.net>2015-12-31 12:43:15 +0200
commitac7d27d4f94ddcaacd9eef563f8ff6d3e90fa12f (patch)
tree42e653b2c119eda8b90097ebda958bc6ec2275f2 /src/wallet/wallet2.cpp
parentMerge pull request #583 (diff)
parentwallet: don't forget to close the file after storing cache (diff)
downloadmonero-ac7d27d4f94ddcaacd9eef563f8ff6d3e90fa12f.tar.xz
Merge pull request #584
5c67c48 wallet: don't forget to close the file after storing cache (moneromooo-monero)
Diffstat (limited to 'src/wallet/wallet2.cpp')
-rw-r--r--src/wallet/wallet2.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp
index 6fda19a42..bceea367f 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -1305,9 +1305,11 @@ void wallet2::store()
const std::string old_file = m_wallet_file + ".old";
// save to new file
- std::ofstream ostr(new_file);
+ std::ofstream ostr;
+ ostr.open(new_file, std::ios_base::binary | std::ios_base::out | std::ios_base::trunc);
binary_archive<true> oar(ostr);
bool success = ::serialization::serialize(oar, cache_file_data);
+ ostr.close();
THROW_WALLET_EXCEPTION_IF(!success || !ostr.good(), error::file_save_error, new_file);
// rename