Syslogd Patch
Denys Vlasenko
vda.linux at googlemail.com
Mon Dec 27 02:21:47 UTC 2010
On Thursday 16 December 2010 12:29, Ronaldo Zacarias Afonso wrote:
> Hi,
>
> My name is Ronaldo, this is my first post to this mailing list.
> I have been using Busybox for a while and, because of a project, I
> had to change Busybox syslogd to only send syslog messages less than
> the Log Level set by the -l command line switch when it's sending
> messages to a remote syslog server. I know -l is used just for local
> message, but I was wandering if it would be nice if this switch
> command line was also used in remote log messages.
> Attached is the patch.
Perhaps it needs to be a separate switch, say, -r NUM?
/* Remote site cannot trust _us_ anyway and need to do validation again */
for (item = G.remoteHosts; item != NULL; item = item->link) {
+ char *p = recvbuf;
+ int pri = (LOG_USER | LOG_NOTICE);
Please use consistent indentation.
+ if (*p == '<') {
+ /* Parse the magic priority number */
+ pri = bb_strtou(p + 1, &p, 10);
+ if (*p == '>')
+ p++;
+ if (pri & ~(LOG_FACMASK | LOG_PRIMASK))
+ pri = (LOG_USER | LOG_NOTICE);
+ }
You duplicated priority parsing code, so there are two copies of it,
and with "-R HOST -L" (log remotely AND locally)
parsing will be done twice. Can it be done once?
--
vda
More information about the busybox
mailing list