mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-13 20:49:02 -04:00
Better checks for NULL log handles
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6083 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
parent
e473ba1a25
commit
f85fdf431e
@ -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()
|
||||
|
Loading…
x
Reference in New Issue
Block a user