mlog: fix crash accessing stale data when rotating logs

This commit is contained in:
moneromooo-monero 2017-07-22 10:46:45 +01:00
parent ab594cfee9
commit 335fc8ab23
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3

View File

@ -129,7 +129,7 @@ void mlog_configure(const std::string &filename_base, bool console)
el::Loggers::addFlag(el::LoggingFlag::DisableApplicationAbortOnFatalLog); el::Loggers::addFlag(el::LoggingFlag::DisableApplicationAbortOnFatalLog);
el::Loggers::addFlag(el::LoggingFlag::ColoredTerminalOutput); el::Loggers::addFlag(el::LoggingFlag::ColoredTerminalOutput);
el::Loggers::addFlag(el::LoggingFlag::StrictLogFileSizeCheck); el::Loggers::addFlag(el::LoggingFlag::StrictLogFileSizeCheck);
el::Helpers::installPreRollOutCallback([&filename_base](const char *name, size_t){ el::Helpers::installPreRollOutCallback([filename_base](const char *name, size_t){
std::string rname = generate_log_filename(filename_base.c_str()); std::string rname = generate_log_filename(filename_base.c_str());
rename(name, rname.c_str()); rename(name, rname.c_str());
}); });