Skip to content

Commit

Permalink
mlog: don't remove old logs if we failed to rename the current file
Browse files Browse the repository at this point in the history
Coverity 188348
  • Loading branch information
moneromooo-monero committed Sep 27, 2018
1 parent 5fdcda5 commit 661439f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion contrib/epee/src/mlog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 661439f

Please sign in to comment.