Project

General

Profile

Bug #404 » fix-lttng-tools-empty-filter.patch

Mathieu Desnoyers, 11/23/2012 03:29 PM

View differences:

include/lttng/lttng.h
* If event_name is NULL, all events are enabled with that filter.
* If channel_name is NULL, the default channel is used (channel0) and created
* if not found.
* If filter_expression is NULL, an event without associated filter is
* created.
*/
extern int lttng_enable_event_with_filter(struct lttng_handle *handle,
struct lttng_event *event, const char *channel_name,
src/bin/lttng-sessiond/main.c
ret = LTTNG_ERR_FILTER_INVAL;
goto error;
}
if (cmd_ctx->lsm->u.enable.bytecode_len == 0) {
ret = LTTNG_ERR_FILTER_INVAL;
goto error;
}
bytecode = zmalloc(cmd_ctx->lsm->u.enable.bytecode_len);
if (!bytecode) {
ret = LTTNG_ERR_FILTER_NOMEM;
src/lib/lttng-ctl/lttng-ctl.c
FILE *fmem;
int ret = 0;
/* Safety check. */
if (handle == NULL || !filter_expression) {
if (!filter_expression) {
/*
* Fall back to normal event enabling if no filter
* specified.
*/
return lttng_enable_event(handle, event, channel_name);
}
/*
* Empty filter string will always be rejected by the parser
* anyway, so treat this corner-case early to eliminate
* lttng_fmemopen error for 0-byte allocation.
*/
if (handle == NULL || filter_expression[0] == '\0') {
return -LTTNG_ERR_INVALID;
}
(3-3/3)