Check for context name duplicata
[lttng-modules.git] / lttng-context-tid.c
index 4e974f8d8e78c35b0fea2d93e98ed00152f4c0cd..d5ccdb635c406d81d60313fad5ecb49945130eec 100644 (file)
@@ -40,11 +40,14 @@ void tid_record(struct lttng_ctx_field *field,
 int lttng_add_tid_to_ctx(struct lttng_ctx **ctx)
 {
        struct lttng_ctx_field *field;
-       int ret;
 
        field = lttng_append_context(ctx);
        if (!field)
-               return ret;
+               return -ENOMEM;
+       if (lttng_find_context(*ctx, "tid")) {
+               lttng_remove_context_field(ctx, field);
+               return -EEXIST;
+       }
        field->event_field.name = "tid";
        field->event_field.type.atype = atype_integer;
        field->event_field.type.u.basic.integer.size = sizeof(pid_t) * CHAR_BIT;
This page took 0.023877 seconds and 4 git commands to generate.