X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=formats%2Fctf%2Fctf.c;h=d6d078f5386308ee26db4a58a2cd2d03681f896c;hb=c13e6f6d63053af00157695ed514d4c084bd85c5;hp=c5d654c975f60a7ad74d3574eec377468ad185ce;hpb=eb75a494900f763d9daca6a9bab5a8f01ffe552f;p=babeltrace.git diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c index c5d654c9..d6d078f5 100644 --- a/formats/ctf/ctf.c +++ b/formats/ctf/ctf.c @@ -157,6 +157,14 @@ struct bt_format ctf_format = { .convert_index_timestamp = ctf_convert_index_timestamp, }; +void bt_ctf_hook(void) +{ + /* + * Dummy function to prevent the linker from discarding this format as + * "unused" in static builds. + */ +} + static uint64_t ctf_timestamp_begin(struct bt_trace_descriptor *descriptor, struct bt_trace_handle *handle, enum bt_clock_type type) @@ -779,8 +787,6 @@ int ctf_init_pos(struct ctf_stream_pos *pos, struct bt_trace_descriptor *trace, pos->parent.rw_table = write_dispatch_table; pos->parent.event_cb = ctf_write_event; pos->parent.trace = trace; - if (fd >= 0) - ctf_packet_seek(&pos->parent, 0, SEEK_SET); /* position for write */ break; default: assert(0); @@ -2431,8 +2437,10 @@ struct bt_trace_descriptor *ctf_open_trace(const char *path, int flags, return &td->parent; error: - trace_debug_info_destroy(td); - g_free(td); + if (td) { + trace_debug_info_destroy(td); + g_free(td); + } return NULL; }