Fix: handle packet_seek errors
[babeltrace.git] / lib / iterator.c
index d439d7b926c52f6cdee9a7716d2bc75d3d3d194f..30a45423dfc1c2130b342aa7d274bd8dcd9b39d0 100644 (file)
@@ -144,6 +144,10 @@ static int seek_file_stream_by_timestamp(struct ctf_file_stream *cfs,
                        continue;
 
                stream_pos->packet_seek(&stream_pos->parent, i, SEEK_SET);
+               ret = bt_packet_seek_get_error();
+               if (ret < 0) {
+                       return EOF;
+               }
                do {
                        ret = stream_read_event(cfs);
                } while (cfs->parent.real_timestamp < timestamp && ret == 0);
@@ -243,6 +247,10 @@ static int find_max_timestamp_ctf_file_stream(struct ctf_file_stream *cfs,
         */
        for (i = stream_pos->packet_index->len - 1; i >= 0; i--) {
                stream_pos->packet_seek(&stream_pos->parent, i, SEEK_SET);
+               ret = bt_packet_seek_get_error();
+               if (ret < 0) {
+                       return EOF;
+               }
                count = 0;
                /* read each event until we reach the end of the stream */
                do {
This page took 0.022713 seconds and 4 git commands to generate.