bug-inetutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Fwd: [bug-inetutils] [PATCH] fix whitespace parsing in syslogd


From: Robert Millan
Subject: Fwd: [bug-inetutils] [PATCH] fix whitespace parsing in syslogd
Date: Fri, 29 Aug 2003 16:13:11 +0000
User-agent: Mutt/1.5.4i

Hi Julian,

Upstream revised your patch and provides a new version (attached). Please
could you tell us wether this one fixes it?

Also, IIRC you sent me a syslog.conf in your past report. Do you want me
to include it in the package?

On Fri, Aug 29, 2003 at 03:11:15PM +0200, Marcus Brinkmann wrote:
> On Thu, Aug 28, 2003 at 07:32:18PM +0000, Robert Millan wrote:
> > > *.=info;*.=notice;*.=warn;\
> > >   auth,authpriv.none;\
> > >   cron,daemon.none;\
> > >   mail,news.none          -/var/log/messages
> 
> Note that this makes it non-intuitive how to split a selector from the
> action.  You would have to use:
> 
> *.=info \
>       -/var/log/messages
> 
> while
> *.=info\
>       -/var/log/messages
> 
> would be wrong.  Anyway, can you please test this patch?  If it does solve the
> problem for you, I can check it in.
> 
> 
> 2003-08-29  Marcus Brinkmann  <address@hidden>
> 
>         * syslogd.c (init): Use strchr instead memchr.  Skip whitespace at
>         the beginning of the next part of a continued line.
> 
> Index: syslogd.c
> ===================================================================
> RCS file: /cvsroot/inetutils/inetutils/syslogd/syslogd.c,v
> retrieving revision 1.68
> diff -u -p -r1.68 syslogd.c
> --- syslogd.c 21 May 2003 14:50:57 -0000      1.68
> +++ syslogd.c 29 Aug 2003 13:07:53 -0000
> @@ -1620,6 +1620,7 @@ init (int signo)
>    size_t line_max = LINE_MAX;
>    char *cbuf;
>    char *cline;
> +  int cont_line = 0;
>    struct servent *sp;
>  
>    (void) signo;  /* Ignored.  */
> @@ -1696,8 +1697,22 @@ init (int signo)
>      {
>        size_t len = strlen (cline);
>  
> -      /* No newline ? then line is too big for the buffer readjust.  */
> -      if (memchr (cline, '\n', len) == NULL)
> +      /* If this is a continuation line, skip leading whitespace for
> +      compatibility with sysklogd.  Note that this requires
> +      whitespace before the backslash in the previous line if you
> +      want to separate the selector from the action.  */
> +      if (cont_line)
> +     {
> +       char *start = cline;
> +       while (*start == ' ' || *start == '\t')
> +         start++;
> +       len = len - (start - cline);
> +       memmove (cline, start, len + 1);
> +       cont_line = 0;
> +     }
> +
> +      /* No newline, so the line is too big for the buffer.  Readjust.  */
> +      if (strchr (cline, '\n') == NULL)
>       {
>         char *tmp;
>         tmp = realloc (cbuf, line_max * 2);
> @@ -1737,6 +1752,7 @@ init (int signo)
>       {
>         *p = '\0';
>         cline = p;
> +       cont_line = 1;
>         continue;
>       }
>  
> 
> 
> 
> 
> -- 
> `Rhubarb is no Egyptian god.' GNU      http://www.gnu.org    address@hidden
> Marcus Brinkmann              The Hurd http://www.gnu.org/software/hurd/
> address@hidden
> http://www.marcus-brinkmann.de/

-- 
Robert Millan

"[..] but the delight and pride of Aule is in the deed of making, and in the
thing made, and neither in possession nor in his own mastery; wherefore he
gives and hoards not, and is free from care, passing ever on to some new work."

 -- J.R.R.T, Ainulindale (Silmarillion)




reply via email to

[Prev in Thread] Current Thread [Next in Thread]