mirror of
https://github.com/monero-project/monero.git
synced 2024-11-17 08:17:37 +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
1 changed files with 6 additions and 1 deletions
|
@ -137,7 +137,12 @@ void mlog_configure(const std::string &filename_base, bool console, const std::s
|
||||||
el::Loggers::addFlag(el::LoggingFlag::StrictLogFileSizeCheck);
|
el::Loggers::addFlag(el::LoggingFlag::StrictLogFileSizeCheck);
|
||||||
el::Helpers::installPreRollOutCallback([filename_base, max_log_files](const char *name, size_t){
|
el::Helpers::installPreRollOutCallback([filename_base, max_log_files](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());
|
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)
|
if (max_log_files != 0)
|
||||||
{
|
{
|
||||||
std::vector<boost::filesystem::path> found_files;
|
std::vector<boost::filesystem::path> found_files;
|
||||||
|
|
Loading…
Reference in a new issue