LTTng-live usage documentation
[babeltrace.git] / formats / ctf / ctf.c
index 9f807c9e2d9910dcfe0a089c2ffaf200da766f12..141f9bfae0c7c7dd040471d74c725fc97a622bc0 100644 (file)
@@ -887,9 +887,12 @@ void ctf_packet_seek(struct bt_stream_pos *stream_pos, size_t index, int whence)
                                return;
                        }
                        assert(pos->cur_index < pos->packet_index->len);
-                       if (index > 0) {
+                       packet_index = &g_array_index(pos->packet_index,
+                                       struct packet_index, pos->cur_index);
+                       if (pos->cur_index > 0) {
                                prev_index = &g_array_index(pos->packet_index,
-                                               struct packet_index, index - 1);
+                                               struct packet_index,
+                                               pos->cur_index - 1);
                        }
                        ctf_update_current_packet_index(&file_stream->parent,
                                        prev_index, packet_index);
@@ -2324,6 +2327,7 @@ struct bt_trace_descriptor *ctf_open_mmap_trace(
                goto error;
        }
        td = g_new0(struct ctf_trace, 1);
+       td->dirfd = -1;
        ret = ctf_open_mmap_trace_read(td, mmap_list, packet_seek, metadata_fp);
        if (ret)
                goto error_free;
This page took 0.02433 seconds and 4 git commands to generate.