#26 appender_type_mmap unexpected behaviour at end of file

closed-fixed
None
5
2012-10-04
2011-02-22
sei1
No

The supplied mmap appender handles the end of the file and prints the rest of the rendered_message at the start of the mmaped file, but instead prints the start of the message again. The append function should alter the pointer passed to memcpy to print the end of the message:

...
+ char *msg = a_event->evt_rendered_msg;

if (!minfo && !minfo->ptr)
return 0;

size = strlen(a_event->evt_rendered_msg);
available = ((char *)minfo->addr + minfo->length) - (char *)minfo->ptr;

if (size > available) {
- memcpy(minfo->ptr, a_event->evt_rendered_msg, available);
+ memcpy(minfo->ptr, msg, available);
minfo->ptr = minfo->addr;
size -= available;
+ msg = msg + available;
}

- memcpy(minfo->ptr, a_event->evt_rendered_msg, size);
+ memcpy(minfo->ptr, msg, size);
minfo->ptr = (char *)minfo->ptr + size;
return 0;
}

Discussion

  • František Dvořák

    Fixed in CVS HEAD, thanks.

     
  • František Dvořák

    • assigned_to: nobody --> valtri
    • status: open --> open-fixed
     
  • František Dvořák

    • status: open-fixed --> closed-fixed
     
  • František Dvořák

    log4c-1.2.2 released.

     

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks