From: Julien Desfossez Date: Fri, 2 Jun 2017 12:44:22 +0000 (-0400) Subject: Fix copytrace: packet header is optional X-Git-Tag: v2.0.0-pre1~63 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=944eed39a1ec69fc7ba752aa1607aa97e80abfee Fix copytrace: packet header is optional Signed-off-by: Julien Desfossez Signed-off-by: Jérémie Galarneau --- diff --git a/plugins/libctfcopytrace/ctfcopytrace.c b/plugins/libctfcopytrace/ctfcopytrace.c index cd8f2d5c..882ab85a 100644 --- a/plugins/libctfcopytrace/ctfcopytrace.c +++ b/plugins/libctfcopytrace/ctfcopytrace.c @@ -894,18 +894,14 @@ enum bt_component_status ctf_copy_trace(FILE *err, struct bt_ctf_trace *trace, } header_type = bt_ctf_trace_get_packet_header_type(writer_trace); - if (!header_type) { - fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__, __LINE__); - ret = BT_COMPONENT_STATUS_ERROR; - goto end; - } - - int_ret = bt_ctf_trace_set_packet_header_type(writer_trace, header_type); - BT_PUT(header_type); - if (int_ret < 0) { - fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__, __LINE__); - ret = BT_COMPONENT_STATUS_ERROR; - goto end; + if (header_type) { + int_ret = bt_ctf_trace_set_packet_header_type(writer_trace, header_type); + BT_PUT(header_type); + if (int_ret < 0) { + fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__, __LINE__); + ret = BT_COMPONENT_STATUS_ERROR; + goto end; + } } end: