mirror of
https://github.com/Retropex/bitcoin.git
synced 2025-05-28 21:12:29 +02: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
@ -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…
Reference in New Issue
Block a user