Check for context name duplicata
[lttng-modules.git] / lttng-context-vppid.c
index 813ccc61115d31a26463ead8ce647d949e2e9d6b..4abf784613afebf844f9be3ed92946519dbff31f 100644 (file)
@@ -43,11 +43,14 @@ void vppid_record(struct lttng_ctx_field *field,
 int lttng_add_vppid_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, "vppid")) {
+               lttng_remove_context_field(ctx, field);
+               return -EEXIST;
+       }
        field->event_field.name = "vppid";
        field->event_field.type.atype = atype_integer;
        field->event_field.type.u.basic.integer.size = sizeof(pid_t) * CHAR_BIT;
This page took 0.02359 seconds and 4 git commands to generate.