summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-12-23 23:58:26 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-12-23 23:58:26 +0000
commitf85fdf431e6ba24019315ab35d6fe0c76f24934f (patch)
tree1a7a6f36c5027ebba5b08f22cfb1515266a810c9 /src
parente473ba1a256b6b38a7ac567ae5b77612e1781a82 (diff)
Better checks for NULL log handles
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6083 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/inspircd.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index c8be0d019..694627d83 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -959,7 +959,8 @@ bool FileLogger::Readable()
void FileLogger::HandleEvent(EventType et, int errornum)
{
this->WriteLogLine("");
- ServerInstance->SE->DelFd(this);
+ if (log)
+ ServerInstance->SE->DelFd(this);
}
void FileLogger::WriteLogLine(const std::string &line)
@@ -1000,18 +1001,24 @@ void FileLogger::Close()
fcntl(fileno(log), F_SETFL, flags ^ O_NONBLOCK);
if (buffer.size())
fprintf(log,"%s",buffer.c_str());
+
+ ServerInstance->SE->DelFd(this);
+
fflush(log);
fclose(log);
}
+
buffer = "";
- ServerInstance->SE->DelFd(this);
}
FileLogger::FileLogger(InspIRCd* Instance, FILE* logfile) : ServerInstance(Instance), log(logfile), writeops(0)
{
- irc::sockets::NonBlocking(fileno(log));
- this->SetFd(fileno(log));
- buffer = "";
+ if (log)
+ {
+ irc::sockets::NonBlocking(fileno(log));
+ this->SetFd(fileno(log));
+ buffer = "";
+ }
}
FileLogger::~FileLogger()