From 7eda6fc7537f70a15af83ad11cc3a8c549052028 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Tue, 2 Aug 2011 16:34:01 -0400 Subject: [PATCH] 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 --- formats/ctf/ctf.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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; } -- 2.34.1