[PATCH] syslogd: Respect -l parameter in remote logs

Denys Vlasenko vda.linux at googlemail.com
Fri Mar 15 01:03:33 UTC 2013


On Monday 04 March 2013 20:19, jonh.wendell at gmail.com wrote:
> From: Jonh Wendell <jonh.wendell at oiwifi.com.br>
> 
> Currently we are ignoring the '-l' command line with
> regards to remote logging. We're sending all logs to
> the remote machine.
> 
> This patch makes remote logging behave just like local
> logging by honoring the '-l' flag.
> 
> Signed-off-by: Jonh Wendell <jonh.wendell at oiwifi.com.br>
> ---
>  sysklogd/syslogd.c |   87 ++++++++++++++++++++++++++++++----------------------
>  1 file changed, 51 insertions(+), 36 deletions(-)
> 
> diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c
> index 3fe3f53..a19ad6e 100644
> --- a/sysklogd/syslogd.c
> +++ b/sysklogd/syslogd.c
> @@ -758,6 +758,24 @@ static void timestamp_and_log_internal(const char *msg)
>  	timestamp_and_log(LOG_SYSLOG | LOG_INFO, (char*)msg, 0);
>  }
>  
> +static int extract_prio (char **buf)
> +{
> +	char *p = *buf;
> +	int pri = (LOG_USER | LOG_NOTICE);
> +
> +	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);
> +	}
> +
> +	buf = &p;

This does not look right: you assign to a local variable
which is about to exit its scope.

> +	return pri;
> +}



More information about the busybox mailing list