X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Flib%2Flttng-ctl%2Flttng-ctl.c;h=a8c6c9b24adc33a3b13a14b2f206ffea5edc8230;hp=0f9378c2c5d82507df87d2b83a46a5d5f192d733;hb=1bec5f09b2833828aec3c60188d68b2a116f1ee5;hpb=cf0bcb51ea857687a353d2851e572dba6cc63cb0 diff --git a/src/lib/lttng-ctl/lttng-ctl.c b/src/lib/lttng-ctl/lttng-ctl.c index 0f9378c2c..a8c6c9b24 100644 --- a/src/lib/lttng-ctl/lttng-ctl.c +++ b/src/lib/lttng-ctl/lttng-ctl.c @@ -797,7 +797,7 @@ static char *set_agent_filter(const char *filter, struct lttng_event *ev) assert(ev); /* Don't add filter for the '*' event. */ - if (ev->name[0] != '*') { + if (strcmp(ev->name, "*") != 0) { if (filter) { err = asprintf(&agent_filter, "(%s) && (logger_name == \"%s\")", filter, ev->name); @@ -920,12 +920,28 @@ static int generate_filter(char *filter_expression, ret = -LTTNG_ERR_FILTER_INVAL; goto parse_error; } + + /* Normalize globbing patterns in the expression. */ + ret = filter_visitor_ir_normalize_glob_patterns(ctx); + if (ret) { + ret = -LTTNG_ERR_FILTER_INVAL; + goto parse_error; + } + /* Validate strings used as literals in the expression. */ ret = filter_visitor_ir_validate_string(ctx); if (ret) { ret = -LTTNG_ERR_FILTER_INVAL; goto parse_error; } + + /* Validate globbing patterns in the expression. */ + ret = filter_visitor_ir_validate_globbing(ctx); + if (ret) { + ret = -LTTNG_ERR_FILTER_INVAL; + goto parse_error; + } + dbg_printf("done\n"); dbg_printf("Generating bytecode... "); @@ -2031,14 +2047,14 @@ int lttng_calibrate(struct lttng_handle *handle, void lttng_channel_set_default_attr(struct lttng_domain *domain, struct lttng_channel_attr *attr) { - struct lttng_channel_extended *extended = - (struct lttng_channel_extended *) attr->extended.ptr; + struct lttng_channel_extended *extended; /* Safety check */ if (attr == NULL || domain == NULL) { return; } + extended = (struct lttng_channel_extended *) attr->extended.ptr; memset(attr, 0, sizeof(struct lttng_channel_attr)); /* Same for all domains. */ @@ -2591,7 +2607,7 @@ int lttng_register_trigger(struct lttng_trigger *trigger) } if (!lttng_trigger_validate(trigger)) { - ret = -LTTNG_ERR_INVALID; + ret = -LTTNG_ERR_INVALID_TRIGGER; goto end; }