aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/wallet2.cpp
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2015-12-31 10:34:17 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2015-12-31 10:34:17 +0000
commit5c67c486e866c9caaeeff4bd990600a91f5a246c (patch)
treed24ff7fec0c48265724e6229959452e42e1991bc /src/wallet/wallet2.cpp
parentMerge pull request #578 (diff)
downloadmonero-5c67c486e866c9caaeeff4bd990600a91f5a246c.tar.xz
wallet: don't forget to close the file after storing cache
Also add some flags to open, as epee's save_string_to_file does, to truncate file, etc.
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 cfa33b283..5ba7d937f 100644
--- a/src/wallet/wallet2.cpp
+++ b/src/wallet/wallet2.cpp
@@ -1288,9 +1288,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