From b42d4e4eb51a906d1391a6d595fe7bff8b427c7d Mon Sep 17 00:00:00 2001 From: Julien Desfossez Date: Wed, 14 Mar 2012 14:58:08 -0400 Subject: [PATCH] fix : bt_ctf_iter_create defaults to BEGIN pos With the context notion it does not make sense to start the iterator at the current position, so we default to BT_SEEK_BEGIN if begin_pos is NULL. Signed-off-by: Julien Desfossez Signed-off-by: Mathieu Desnoyers --- lib/iterator.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/lib/iterator.c b/lib/iterator.c index ca6e5917..f820fdb6 100644 --- a/lib/iterator.c +++ b/lib/iterator.c @@ -474,14 +474,22 @@ int bt_iter_init(struct bt_iter *iter, filenr); if (begin_pos) { - ret = babeltrace_filestream_seek(file_stream, begin_pos, + ret = babeltrace_filestream_seek( + file_stream, + begin_pos, stream_id); - if (ret == EOF) { - ret = 0; - continue; - } else if (ret) { - goto error; - } + } else { + struct bt_iter_pos pos; + pos.type = BT_SEEK_BEGIN; + ret = babeltrace_filestream_seek( + file_stream, &pos, + stream_id); + } + if (ret == EOF) { + ret = 0; + continue; + } else if (ret) { + goto error; } /* Add to heap */ ret = heap_insert(iter->stream_heap, file_stream); -- 2.34.1