Fix: deny multiple event types with enable-event
[lttng-tools.git] / src / bin / lttng / commands / enable_events.c
index 0e6bb55d8bc7b618fadcc830c1a7ee736145a3c3..57837eb7dcadd3828110b7a7f386460ad491a570 100644 (file)
@@ -634,6 +634,7 @@ int cmd_enable_events(int argc, const char **argv)
        int opt, ret = CMD_SUCCESS;
        static poptContext pc;
        char *session_name = NULL;
+       int event_type = -1;
 
        pc = poptGetContext(NULL, argc, argv, long_options, 0);
        poptReadDefaultConfig(pc, 0);
@@ -682,6 +683,17 @@ int cmd_enable_events(int argc, const char **argv)
                        ret = CMD_UNDEFINED;
                        goto end;
                }
+
+               /* Validate event type. Multiple event type are not supported. */
+               if (event_type == -1) {
+                       event_type = opt_event_type;
+               } else {
+                       if (event_type != opt_event_type) {
+                               ERR("Multiple event type not supported.");
+                               ret = CMD_ERROR;
+                               goto end;
+                       }
+               }
        }
 
        opt_event_list = (char*) poptGetArg(pc);
This page took 0.024603 seconds and 5 git commands to generate.