From: Mathieu Desnoyers Date: Tue, 2 Aug 2011 20:34:01 +0000 (-0400) Subject: Fix reading of empty packets X-Git-Tag: v0.3~5 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=7eda6fc7537f70a15af83ad11cc3a8c549052028 Fix reading of empty packets Prior to this fix, an empty packet would be considered as an end of file. (off-by-one in the size comparison) Signed-off-by: Mathieu Desnoyers --- diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c index 021abf88..7120207d 100644 --- a/formats/ctf/ctf.c +++ b/formats/ctf/ctf.c @@ -415,9 +415,9 @@ void ctf_move_pos_slow(struct ctf_stream_pos *pos, size_t offset, int whence) file_stream->parent.timestamp = index->timestamp_begin; pos->content_size = index->content_size; pos->packet_size = index->packet_size; - if (index->data_offset < index->content_size) + if (index->data_offset <= index->content_size) { pos->offset = 0; /* will read headers */ - else { + } else { pos->offset = EOF; return; }