[syslog-ng] [PATCH] logproto: Fix log_proto_file_writer_flush()'s partial construction.

Balazs Scheidler bazsi at balabit.hu
Sat Oct 29 13:50:47 CEST 2011


On Sat, 2011-10-29 at 11:15 +0200, Gergely Nagy wrote:
> Szalay Attila <sasa at balabit.hu> writes:
> 
> >> diff --git a/lib/logproto.c b/lib/logproto.c
> >> index bdf9695..5047c98 100644
> >> --- a/lib/logproto.c
> >> +++ b/lib/logproto.c
> >> @@ -299,7 +299,7 @@ log_proto_file_writer_flush(LogProto *s)
> >>        /* allocate and copy the remaning data */
> >>        self->partial = (guchar *)g_malloc(self->partial_len);
> >>        ofs = sum - rc; /* the length of the remaning (not processed) chunk in the first message */
> >> -        memcpy(self->partial, self->buffer[i0].iov_base + rc - (i0 > 0 ? (sum - self->buffer[i0 - 1].iov_len) : 0), ofs);
> >> +      memcpy(self->partial, self->buffer[i0].iov_len - ofs, ofs);
> >>        i = i0 + 1;
> >>        while (i < self->buf_count)
> >>          {
> >
> > I think this patch has some problem too.
> 
> ACK. I really should not code half-asleep. Thanks for catching the
> mistake!
> 

Can you post an updated patch please?

Thanks.

-- 
Bazsi




More information about the syslog-ng mailing list