affile: Mark messages as consumed in a write failure. #1725
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix a crash that occurs following a write failure when the file writer
buffer becomes full and a config reload is triggered.
If a write failure occurs in log_proto_file_writer_post as the buffer
becomes full, a subsequent call will be made where msg and
self->buffer[self->buff_count].iov_base point to the same memory.
The first call to log_proto_file_writer_flush will write the message
and free the buffer. The following call will raise an abort signal
when it attempts to free the buffer a second time.
If the message has been stored in self->buffer, it should be marked
as consumed irrespective of the result of log_proto_file_writer_flush.
This may relate to #1425
Signed-off-by: Sam Stephenson sam.stephenson@alliedtelesis.co.nz