From: David Goulet Date: Thu, 11 Apr 2013 20:25:50 +0000 (-0400) Subject: Fix: deny multiple event types with enable-event X-Git-Tag: v2.2.0-rc2~47 X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=commitdiff_plain;h=de044b7a0613db6d16151ac9f7b7be404c0bb493 Fix: deny multiple event types with enable-event Fixes #444 Signed-off-by: David Goulet --- diff --git a/src/bin/lttng/commands/enable_events.c b/src/bin/lttng/commands/enable_events.c index 0e6bb55d8..57837eb7d 100644 --- a/src/bin/lttng/commands/enable_events.c +++ b/src/bin/lttng/commands/enable_events.c @@ -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);