Fix: deny multiple event types with enable-event
authorDavid Goulet <dgoulet@efficios.com>
Thu, 11 Apr 2013 20:25:50 +0000 (16:25 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Thu, 11 Apr 2013 20:25:50 +0000 (16:25 -0400)
Fixes #444

Signed-off-by: David Goulet <dgoulet@efficios.com>
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.027649 seconds and 4 git commands to generate.