[OpenWrt-Devel] [PATCH] [PKG_NAME=ubox] [git://nbd.name/luci2/ubox.git] [FILE=logger.c] current OpenWrt trunc

John Crispin blogic at openwrt.org
Tue Sep 16 08:27:33 EDT 2014


thank you, merged in r42572


On 16/09/2014 10:53, Бельков Максим wrote:
> From: Belkov Max <belkov-max at mail.ru>
>
> When logread daemon send a syslog message to another host, time, severity
> and facility are cut off.
> The message contains only text.
> This path adds time, severity and facility in the message as described in
> the RFC 3164.
> Signed-off-by: Belkov Max <belkov-max at mail.ru>
> ---
> Patched one file: logread.c
> This patch been tested and work well.
>
> --- /home/max/openwrt/l/log/logread.c.old	2014-09-15
> 03:03:50.000000000 +0400
> +++ /home/max/openwrt/l/log/logread.c	2014-09-16 12:04:44.388950951 +0400
> @@ -135,9 +135,14 @@ static int log_notify(struct blob_attr *
>  	if (log_type == LOG_NET) {
>  		int err;
>  
> -		*buf = '\0';
> -		if (hostname)
> -			snprintf(buf, sizeof(buf), "%s ", hostname);
> +		snprintf(buf, sizeof(buf), "<%u>", p);
> +		/* extract syslog time from "Wed Jun 30 21:49:08 1993" and
> obtain
> +                   "Jun 30 21:49:08 " according RFC 3164 */
> +		strncat(buf, c + 4, 16);
> +		if (hostname) {
> +			strncat(buf, hostname, sizeof(buf));
> +			strncat(buf, " ", sizeof(buf));
> +		}
>  		if (log_prefix) {
>  			strncat(buf, log_prefix, sizeof(buf));
>  			strncat(buf, ": ", sizeof(buf));
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list