mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-26 19:23:26 -03:00
Don't close old debug log file handle prematurely when trying to re-open (on SIGHUP)
This commit is contained in:
parent
2ddce35abc
commit
cceedbc4bf
1 changed files with 5 additions and 5 deletions
|
@ -219,13 +219,13 @@ void 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;
|
||||||
m_fileout = fsbridge::freopen(m_file_path, "a", m_fileout);
|
FILE* new_fileout = fsbridge::fopen(m_file_path, "a");
|
||||||
if (!m_fileout) {
|
if (new_fileout) {
|
||||||
return;
|
setbuf(new_fileout, nullptr); // unbuffered
|
||||||
|
fclose(m_fileout);
|
||||||
|
m_fileout = new_fileout;
|
||||||
}
|
}
|
||||||
setbuf(m_fileout, nullptr); // unbuffered
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FileWriteStr(strTimestamped, m_fileout);
|
FileWriteStr(strTimestamped, m_fileout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue