mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-12-22 12:08:52 +00:00
mlog: don't remove old logs if we failed to rename the current file
Coverity 188348
This commit is contained in:
parent
5fdcda50ee
commit
661439f4e0
@ -137,7 +137,12 @@ void mlog_configure(const std::string &filename_base, bool console, const std::s
|
||||
el::Loggers::addFlag(el::LoggingFlag::StrictLogFileSizeCheck);
|
||||
el::Helpers::installPreRollOutCallback([filename_base, max_log_files](const char *name, size_t){
|
||||
std::string rname = generate_log_filename(filename_base.c_str());
|
||||
rename(name, rname.c_str());
|
||||
int ret = rename(name, rname.c_str());
|
||||
if (ret < 0)
|
||||
{
|
||||
// can't log a failure, but don't do the file removal below
|
||||
return;
|
||||
}
|
||||
if (max_log_files != 0)
|
||||
{
|
||||
std::vector<boost::filesystem::path> found_files;
|
||||
|
Loading…
Reference in New Issue
Block a user