mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-01-25 10:43:19 -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
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue