Fix: error out on leftover arguments
[lttng-tools.git] / src / bin / lttng / commands / enable_events.c
index cc79b0b749247f83123b5252e1aed833bb3fd669..05f20f72de03309afda2add9c268a9d934fbe77f 100644 (file)
@@ -26,7 +26,7 @@
 #include <inttypes.h>
 #include <ctype.h>
 
-#include <src/common/sessiond-comm/sessiond-comm.h>
+#include <common/sessiond-comm/sessiond-comm.h>
 #include <common/compat/string.h>
 #include <common/string-utils/string-utils.h>
 
@@ -504,24 +504,6 @@ end:
        return ret;
 }
 
-static
-int check_exclusions_subsets(const char *event_name,
-               char * const *exclusions)
-{
-       int ret = 0;
-       char * const *item;
-
-       for (item = exclusions; *item; item++) {
-               ret = check_exclusion_subsets(event_name, *item);
-               if (ret) {
-                       goto end;
-               }
-       }
-
-end:
-       return ret;
-}
-
 static
 int create_exclusion_list_and_validate(const char *event_name,
                const char *exclusions_arg,
@@ -554,8 +536,7 @@ int create_exclusion_list_and_validate(const char *event_name,
                for (exclusion = exclusions; *exclusion; exclusion++) {
                        if (!strutils_is_star_glob_pattern(*exclusion) ||
                                        strutils_is_star_at_the_end_only_glob_pattern(*exclusion)) {
-                               ret = check_exclusions_subsets(
-                                       event_name, exclusion);
+                               ret = check_exclusion_subsets(event_name, *exclusion);
                                if (ret) {
                                        goto error;
                                }
@@ -1283,6 +1264,7 @@ int cmd_enable_events(int argc, const char **argv)
        int opt, ret = CMD_SUCCESS, command_ret = CMD_SUCCESS, success = 1;
        static poptContext pc;
        char *session_name = NULL;
+       const char *leftover = NULL;
        int event_type = -1;
 
        pc = poptGetContext(NULL, argc, argv, long_options, 0);
@@ -1382,6 +1364,13 @@ int cmd_enable_events(int argc, const char **argv)
                goto end;
        }
 
+       leftover = poptGetArg(pc);
+       if (leftover) {
+               ERR("Unknown argument: %s", leftover);
+               ret = CMD_ERROR;
+               goto end;
+       }
+
        if (!opt_session_name) {
                session_name = get_session_name();
                if (session_name == NULL) {
This page took 0.024963 seconds and 5 git commands to generate.