From de044b7a0613db6d16151ac9f7b7be404c0bb493 Mon Sep 17 00:00:00 2001 From: David Goulet Date: Thu, 11 Apr 2013 16:25:50 -0400 Subject: [PATCH] Fix: deny multiple event types with enable-event Fixes #444 Signed-off-by: David Goulet --- src/bin/lttng/commands/enable_events.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) 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); -- 2.34.1