From 944eed39a1ec69fc7ba752aa1607aa97e80abfee Mon Sep 17 00:00:00 2001 From: Julien Desfossez Date: Fri, 2 Jun 2017 08:44:22 -0400 Subject: [PATCH] Fix copytrace: packet header is optional MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Julien Desfossez Signed-off-by: Jérémie Galarneau --- plugins/libctfcopytrace/ctfcopytrace.c | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) 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: -- 2.34.1