copy_trace: copy the trace name
[babeltrace.git] / plugins / libctfcopytrace / ctfcopytrace.c
index a56e8146a306940af406b420e8a3906f863a4ed2..54a7fd14d175221989e01cf9ecabd0915d4a3f28 100644 (file)
@@ -808,6 +808,7 @@ enum bt_component_status ctf_copy_trace(FILE *err, struct bt_ctf_trace *trace,
        int field_count, i, int_ret;
        struct bt_ctf_field_type *header_type = NULL;
        enum bt_ctf_byte_order order;
+       const char *trace_name;
 
        field_count = bt_ctf_trace_get_environment_field_count(trace);
        for (i = 0; i < field_count; i++) {
@@ -878,6 +879,16 @@ enum bt_component_status ctf_copy_trace(FILE *err, struct bt_ctf_trace *trace,
                }
        }
 
+       trace_name = bt_ctf_trace_get_name(trace);
+       if (trace_name) {
+               int_ret = bt_ctf_trace_set_name(writer_trace, trace_name);
+               if (int_ret < 0) {
+                       fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__, __LINE__);
+                       ret = BT_COMPONENT_STATUS_ERROR;
+                       goto end;
+               }
+       }
+
 end:
        return ret;
 }
This page took 0.023011 seconds and 4 git commands to generate.