const struct lttng_event_rule *rule,
struct lttng_kernel_event_notifier *kernel_event_notifier)
{
- enum lttng_error_code ret;
+ enum lttng_error_code ret_code;
const char *name;
+ int strncpy_ret;
switch (lttng_event_rule_get_type(rule)) {
case LTTNG_EVENT_RULE_TYPE_KPROBE:
status = lttng_event_rule_kprobe_get_location(rule, &location);
if (status != LTTNG_EVENT_RULE_STATUS_OK) {
- ret = LTTNG_ERR_PROBE_LOCATION_INVAL;
+ ret_code = LTTNG_ERR_PROBE_LOCATION_INVAL;
goto error;
}
kernel_event_notifier->event.u.kprobe.addr = address;
kernel_event_notifier->event.u.kprobe.offset = offset;
if (symbol_name) {
- const int copy_ret = lttng_strncpy(
+ strncpy_ret = lttng_strncpy(
kernel_event_notifier->event.u.kprobe.symbol_name,
symbol_name, LTTNG_KERNEL_SYM_NAME_LEN);
- if (copy_ret) {
- ret = LTTNG_ERR_INVALID;
+ if (strncpy_ret) {
+ ret_code = LTTNG_ERR_INVALID;
goto error;
}
}
kernel_event_notifier->event.u.kprobe.symbol_name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
status = lttng_event_rule_kprobe_get_name(rule, &name);
assert(status == LTTNG_EVENT_RULE_STATUS_OK);
- ret = LTTNG_OK;
+ ret_code = LTTNG_OK;
break;
}
case LTTNG_EVENT_RULE_TYPE_UPROBE:
status = lttng_event_rule_uprobe_get_location(rule, &location);
if (status != LTTNG_EVENT_RULE_STATUS_OK) {
- ret = LTTNG_ERR_PROBE_LOCATION_INVAL;
+ ret_code = LTTNG_ERR_PROBE_LOCATION_INVAL;
goto error;
}
lookup = lttng_userspace_probe_location_get_lookup_method(
location);
if (!lookup) {
- ret = LTTNG_ERR_PROBE_LOCATION_INVAL;
+ ret_code = LTTNG_ERR_PROBE_LOCATION_INVAL;
goto error;
}
status = lttng_event_rule_uprobe_get_name(rule, &name);
assert(status == LTTNG_EVENT_RULE_STATUS_OK);
- ret = LTTNG_OK;
+ ret_code = LTTNG_OK;
break;
}
case LTTNG_EVENT_RULE_TYPE_TRACEPOINT:
kernel_event_notifier->event.instrumentation =
LTTNG_KERNEL_TRACEPOINT;
- ret = LTTNG_OK;
+ ret_code = LTTNG_OK;
break;
}
case LTTNG_EVENT_RULE_TYPE_SYSCALL:
LTTNG_KERNEL_SYSCALL_ENTRY;
kernel_event_notifier->event.u.syscall.match =
LTTNG_KERNEL_SYSCALL_MATCH_NAME;
- ret = LTTNG_OK;
+ ret_code = LTTNG_OK;
break;
}
case LTTNG_EVENT_RULE_TYPE_KRETPROBE:
break;
}
- ret = lttng_strncpy(kernel_event_notifier->event.name, name,
+ strncpy_ret = lttng_strncpy(kernel_event_notifier->event.name, name,
LTTNG_KERNEL_SYM_NAME_LEN);
- if (ret) {
- ret = LTTNG_ERR_INVALID;
+ if (strncpy_ret) {
+ ret_code = LTTNG_ERR_INVALID;
goto error;
}
error:
- return ret;
+ return ret_code;
}
/*
* Allocate and initialize a kernel metadata.