From: Jérémie Galarneau Date: Tue, 15 Oct 2013 17:23:18 +0000 (-0400) Subject: Fix: Use the packet's final size when mmap-ing the next packet X-Git-Tag: v1.2.0-rc1~39^2~34 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=e0a5b455a6cf824c343fe094a1f75f2565eabb5f Fix: Use the packet's final size when mmap-ing the next packet ctf_packet_seek() assumed that a packet would be of fixed size "WRITE_PACKET_LEN" when seeking to the next packet in write mode. This ensures that the real size used. Signed-off-by: Jérémie Galarneau Reviewed-by: Mathieu Desnoyers Signed-off-by: Mathieu Desnoyers --- diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c index 947b439d..60d9c9f9 100644 --- a/formats/ctf/ctf.c +++ b/formats/ctf/ctf.c @@ -712,7 +712,7 @@ void ctf_packet_seek(struct bt_stream_pos *stream_pos, size_t index, int whence) switch (whence) { case SEEK_CUR: /* The writer will add padding */ - pos->mmap_offset += WRITE_PACKET_LEN / CHAR_BIT; + pos->mmap_offset += pos->packet_size / CHAR_BIT; break; case SEEK_SET: assert(index == 0); /* only seek supported for now */