Merge pull request #2568

7130cf0c Add tools::on_startup, and warn about glibc 2.25 bug if found (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2017-10-15 18:32:09 +02:00
commit c45f3ac4d9
No known key found for this signature in database
GPG Key ID: 55432DF31CCD4FCD
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

@ -571,7 +571,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]);