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.
This commit is contained in:
moneromooo-monero 2015-11-21 10:13:10 +00:00
parent 0c1dae32b4
commit f3724aef88
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3
7 changed files with 33 additions and 1 deletions

View file

@ -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;