diff options
author | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-08-14 20:06:42 +0000 |
---|---|---|
committer | w00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-08-14 20:06:42 +0000 |
commit | 5bac24a5b0db1f6dfadb997f34c627c6c6d08912 (patch) | |
tree | cf13250c8f2c4d295228333100bd436edc30b93a | |
parent | 26e8190a3775bea8a3ef1b2c89184043394ea341 (diff) |
Set log to null on close and check for null loghandle on FileWriter::WriteLogLine.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11516 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | src/logger.cpp | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/logger.cpp b/src/logger.cpp index 05fb801ae..049b4b5e7 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -341,13 +341,15 @@ void FileWriter::HandleEvent(EventType ev, int) void FileWriter::WriteLogLine(const std::string &line) { - if (log) + if (log == NULL) + return; +// XXX: For now, just return. Don't throw an exception. It'd be nice to find out if this is happening, but I'm terrified of breaking so close to final release. -- w00t +// throw CoreException("FileWriter::WriteLogLine called with a closed logfile"); + + fprintf(log,"%s",line.c_str()); + if (writeops++ % 20) { - fprintf(log,"%s",line.c_str()); - if (writeops++ % 20) - { - fflush(log); - } + fflush(log); } } @@ -357,6 +359,7 @@ void FileWriter::Close() { fflush(log); fclose(log); + log = NULL; } } |