logging: Fix potential use-after-free in LogPrintStr(...)
This commit is contained in:
parent
57c57df86f
commit
76f344de6d
1 changed files with 5 additions and 2 deletions
|
@ -222,7 +222,10 @@ int BCLog::Logger::LogPrintStr(const std::string &str)
|
||||||
// reopen the log file, if requested
|
// reopen the log file, if requested
|
||||||
if (m_reopen_file) {
|
if (m_reopen_file) {
|
||||||
m_reopen_file = false;
|
m_reopen_file = false;
|
||||||
if (fsbridge::freopen(m_file_path,"a",m_fileout) != nullptr)
|
m_fileout = fsbridge::freopen(m_file_path, "a", m_fileout);
|
||||||
|
if (!m_fileout) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
setbuf(m_fileout, nullptr); // unbuffered
|
setbuf(m_fileout, nullptr); // unbuffered
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue