The syslog_daemon now ignores zero length messages, and the kernel's syslog

mechanism doesn't send them out any longer.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16153 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2006-01-30 16:09:24 +00:00
parent bd610d2fcd
commit afef4f3fff
3 changed files with 13 additions and 0 deletions

View File

@ -138,6 +138,11 @@ SyslogDaemon::Daemon()
// add terminating null byte
message.message[bytesRead - sizeof(syslog_message)] = '\0';
if (!message.message[0]) {
// ignore empty messages
continue;
}
fHandlerLock.Lock();
for (int32 i = fHandlers.CountItems(); i-- > 0;) {

View File

@ -164,6 +164,8 @@ syslog_output(syslog_message &message)
} else {
length = strlcpy(buffer + headerLength, message.message + pos,
sizeof(buffer) - headerLength);
if (length == 0)
break;
}
length += headerLength;

View File

@ -431,6 +431,12 @@ syslog_sender(void *data)
restore_interrupts(state);
}
if (length == 0) {
// the buffer we came here for might have been sent already
bufferPending = false;
continue;
}
error = write_port_etc(port, SYSLOG_MESSAGE, sSyslogMessage,
sizeof(struct syslog_message) + length, B_RELATIVE_TIMEOUT, 0);