From 7fc26953aa2eea6ea1f6b96429e236ba344d897b Mon Sep 17 00:00:00 2001 From: clemahieu Date: Thu, 14 Apr 2016 23:31:20 -0500 Subject: [PATCH] Fixing issue where config was being clobbered. --- rai/rai_wallet/entry.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/rai/rai_wallet/entry.cpp b/rai/rai_wallet/entry.cpp index ae9bd81b..cb8b4f9b 100644 --- a/rai/rai_wallet/entry.cpp +++ b/rai/rai_wallet/entry.cpp @@ -221,7 +221,18 @@ int run_wallet (int argc, char * const * argv) assert (false); } runner.join (); - error = config.serialize_json_stream (config_file); + config_file.seekg (0); + auto account (config.account); + if (!rai::fetch_object (config, config_file)) + { + if (account != config.account) + { + config.account = account; + config_file.close (); + config_file.open (config_path, std::ios_base::out | std::ios_base::trunc); + error = config.serialize_json_stream (config_file); + } + } } else {