diff options
author | practicalswift <practicalswift@users.noreply.github.com> | 2018-05-03 18:04:58 +0200 |
---|---|---|
committer | practicalswift <practicalswift@users.noreply.github.com> | 2018-08-29 16:05:00 +0200 |
commit | cceedbc4bf1056db17e0adf76d0db45b94777671 (patch) | |
tree | b9e48255de11d24a1aaf62bedfd2211f247f33a1 /src | |
parent | 2ddce35abcb8249722f0cfecebd7b6ffa2a81bcf (diff) |
Don't close old debug log file handle prematurely when trying to re-open (on SIGHUP)
Diffstat (limited to 'src')
-rw-r--r-- | src/logging.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/logging.cpp b/src/logging.cpp index 6557dddffb..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); } } |