diff options
Diffstat (limited to 'src/logging.cpp')
-rw-r--r-- | src/logging.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/logging.cpp b/src/logging.cpp index e8e22cbf97..0ae4f8121e 100644 --- a/src/logging.cpp +++ b/src/logging.cpp @@ -219,13 +219,13 @@ void BCLog::Logger::LogPrintStr(const std::string &str) // reopen the log file, if requested if (m_reopen_file) { m_reopen_file = false; - m_fileout = fsbridge::freopen(m_file_path, "a", m_fileout); - if (!m_fileout) { - return; + FILE* new_fileout = fsbridge::fopen(m_file_path, "a"); + if (new_fileout) { + setbuf(new_fileout, nullptr); // unbuffered + fclose(m_fileout); + m_fileout = new_fileout; } - setbuf(m_fileout, nullptr); // unbuffered } - FileWriteStr(strTimestamped, m_fileout); } } @@ -245,7 +245,7 @@ void BCLog::Logger::ShrinkDebugFile() size_t log_size = 0; try { log_size = fs::file_size(m_file_path); - } catch (boost::filesystem::filesystem_error &) {} + } catch (const fs::filesystem_error&) {} // If debug.log file is more than 10% bigger the RECENT_DEBUG_HISTORY_SIZE // trim it down by saving only the last RECENT_DEBUG_HISTORY_SIZE bytes |