aboutsummaryrefslogtreecommitdiff
path: root/src/blockchain_utilities
diff options
context:
space:
mode:
authormoneromooo-monero <moneromooo-monero@users.noreply.github.com>2015-11-21 10:13:10 +0000
committermoneromooo-monero <moneromooo-monero@users.noreply.github.com>2015-11-21 10:13:10 +0000
commitf3724aef881ff2fdada98eddc792059e4e18c1c8 (patch)
tree492dc86b5344060870877c0a886f67d2c1eaa0b8 /src/blockchain_utilities
parenti18n: allow language to be passed as a parameter (diff)
downloadmonero-f3724aef881ff2fdada98eddc792059e4e18c1c8.tar.xz
Fix startup crash when using a locale boost does not like
There are various locale related bugs in various versions of boost, where exceptions are thrown in boost::filesystem APIs when the current locale is not to boost's liking. It's not clear what "not to boost's liking" means in detail, though "en" and "en_US.UTF-8" are not to its liking. Fix it by running a test function that's known to throw in such a case, and resetting LANG and LC_ALL to C if an exception is thrown. In simplewallet, the locale is queried before that so the correct translations will still be used.
Diffstat (limited to 'src/blockchain_utilities')
-rw-r--r--src/blockchain_utilities/blockchain_dump.cpp2
-rw-r--r--src/blockchain_utilities/blockchain_export.cpp2
-rw-r--r--src/blockchain_utilities/blockchain_import.cpp2
3 files changed, 6 insertions, 0 deletions
diff --git a/src/blockchain_utilities/blockchain_dump.cpp b/src/blockchain_utilities/blockchain_dump.cpp
index 1c3c94636..f3666c72b 100644
--- a/src/blockchain_utilities/blockchain_dump.cpp
+++ b/src/blockchain_utilities/blockchain_dump.cpp
@@ -94,6 +94,8 @@ int main(int argc, char* argv[])
uint32_t log_level = 0;
uint64_t block_stop = 0;
+ tools::sanitize_locale();
+
boost::filesystem::path default_data_path {tools::get_default_data_dir()};
boost::filesystem::path default_testnet_data_path {default_data_path / "testnet"};
boost::filesystem::path output_file_path;
diff --git a/src/blockchain_utilities/blockchain_export.cpp b/src/blockchain_utilities/blockchain_export.cpp
index 1bdaa3d7e..bd463b14e 100644
--- a/src/blockchain_utilities/blockchain_export.cpp
+++ b/src/blockchain_utilities/blockchain_export.cpp
@@ -42,6 +42,8 @@ int main(int argc, char* argv[])
uint64_t block_stop = 0;
bool blocks_dat = false;
+ tools::sanitize_locale();
+
boost::filesystem::path default_data_path {tools::get_default_data_dir()};
boost::filesystem::path default_testnet_data_path {default_data_path / "testnet"};
boost::filesystem::path output_file_path;
diff --git a/src/blockchain_utilities/blockchain_import.cpp b/src/blockchain_utilities/blockchain_import.cpp
index 88d748411..f8158ff2f 100644
--- a/src/blockchain_utilities/blockchain_import.cpp
+++ b/src/blockchain_utilities/blockchain_import.cpp
@@ -538,6 +538,8 @@ int main(int argc, char* argv[])
std::string m_config_folder;
std::string db_arg_str;
+ tools::sanitize_locale();
+
boost::filesystem::path default_data_path {tools::get_default_data_dir()};
boost::filesystem::path default_testnet_data_path {default_data_path / "testnet"};
std::string import_file_path;