X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fenable_events.c;h=1df76e052d04748ee7d3556e0b17a96d491dfb0e;hb=f63488d36657089a47fbd8edc32ce6476fd0dee2;hp=cc79b0b749247f83123b5252e1aed833bb3fd669;hpb=9f449915b9d44ce3c9c9255f5d491a62545fee25;p=lttng-tools.git diff --git a/src/bin/lttng/commands/enable_events.c b/src/bin/lttng/commands/enable_events.c index cc79b0b74..1df76e052 100644 --- a/src/bin/lttng/commands/enable_events.c +++ b/src/bin/lttng/commands/enable_events.c @@ -26,7 +26,7 @@ #include #include -#include +#include #include #include @@ -137,7 +137,7 @@ static int parse_probe_opts(struct lttng_event *ev, char *opt) } /* Check for symbol */ - if (isalpha(name[0])) { + if (isalpha(name[0]) || name[0] == '_') { match = sscanf(opt, "%" LTTNG_SYMBOL_NAME_LEN_SCANF_IS_A_BROKEN_API "s", name); if (match == 1) { @@ -154,8 +154,13 @@ static int parse_probe_opts(struct lttng_event *ev, char *opt) /* Check for address */ match = sscanf(opt, "%" S_HEX_LEN_SCANF_IS_A_BROKEN_API "s", s_hex); if (match > 0) { - if (*s_hex == '\0') { - ERR("Invalid probe address %s", s_hex); + /* + * Return an error if the first character of the tentative + * address is NULL or not a digit. It can be "0" if the address + * is in hexadecimal and can be 1 to 9 if it's in decimal. + */ + if (*s_hex == '\0' || !isdigit(*s_hex)) { + ERR("Invalid probe description %s", s_hex); ret = CMD_ERROR; goto end; } @@ -504,24 +509,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 +541,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 +1269,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 +1369,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) {