Add tools::on_startup, and warn about glibc 2.25 bug if found

https://sourceware.org/bugzilla/show_bug.cgi?id=21778
This commit is contained in:
moneromooo-monero 2017-10-03 10:12:57 +01:00
parent 86e9de588c
commit 7130cf0c61
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3
8 changed files with 23 additions and 6 deletions

View File

@ -55,7 +55,7 @@ int main(int argc, char* argv[])
uint64_t block_stop = 0; uint64_t block_stop = 0;
bool blocks_dat = false; bool blocks_dat = false;
tools::sanitize_locale(); tools::on_startup();
boost::filesystem::path default_data_path {tools::get_default_data_dir()}; 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 default_testnet_data_path {default_data_path / "testnet"};

View File

@ -551,7 +551,7 @@ int main(int argc, char* argv[])
std::string m_config_folder; std::string m_config_folder;
std::string db_arg_str; std::string db_arg_str;
tools::sanitize_locale(); tools::on_startup();
boost::filesystem::path default_data_path {tools::get_default_data_dir()}; 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 default_testnet_data_path {default_data_path / "testnet"};

View File

@ -30,6 +30,10 @@
#include <cstdio> #include <cstdio>
#ifdef __GLIBC__
#include <gnu/libc-version.h>
#endif
#include "include_base_utils.h" #include "include_base_utils.h"
#include "file_io_utils.h" #include "file_io_utils.h"
using namespace epee; using namespace epee;
@ -536,6 +540,17 @@ std::string get_nix_version_display_string()
} }
return false; return false;
} }
bool on_startup()
{
sanitize_locale();
#ifdef __GLIBC__
const char *ver = gnu_get_libc_version();
if (!strcmp(ver, "2.25"))
MCLOG_RED(el::Level::Warning, "global", "Running with glibc " << ver << ", hangs may occur - change glibc version if possible");
#endif
return true;
}
void set_strict_default_file_permissions(bool strict) void set_strict_default_file_permissions(bool strict)
{ {
#if defined(__MINGW32__) || defined(__MINGW__) #if defined(__MINGW32__) || defined(__MINGW__)

View File

@ -129,6 +129,8 @@ namespace tools
bool sanitize_locale(); bool sanitize_locale();
bool on_startup();
/*! \brief Defines a signal handler for win32 and *nix /*! \brief Defines a signal handler for win32 and *nix
*/ */
class signal_handler class signal_handler

View File

@ -61,7 +61,7 @@ int main(int argc, char const * argv[])
// TODO parse the debug options like set log level right here at start // TODO parse the debug options like set log level right here at start
tools::sanitize_locale(); tools::on_startup();
epee::string_tools::set_module_name_and_folder(argv[0]); epee::string_tools::set_module_name_and_folder(argv[0]);

View File

@ -45,7 +45,7 @@ int main(int argc, char* argv[])
uint32_t log_level = 0; uint32_t log_level = 0;
std::string input; std::string input;
tools::sanitize_locale(); tools::on_startup();
boost::filesystem::path output_file_path; boost::filesystem::path output_file_path;

View File

@ -64,7 +64,7 @@ int main(int argc, char* argv[])
{ {
size_logger sl; size_logger sl;
tools::sanitize_locale(); tools::on_startup();
mlog_configure("", true); mlog_configure("", true);

View File

@ -91,7 +91,7 @@ namespace wallet_args
std::string lang = i18n_get_language(); std::string lang = i18n_get_language();
tools::sanitize_locale(); tools::on_startup();
tools::set_strict_default_file_permissions(true); tools::set_strict_default_file_permissions(true);
epee::string_tools::set_module_name_and_folder(argv[0]); epee::string_tools::set_module_name_and_folder(argv[0]);