*/
static int add_context(char *session_name)
{
- int ret = CMD_SUCCESS;
+ int ret = CMD_SUCCESS, warn = 0;
struct lttng_event_context context;
struct lttng_domain dom;
struct ctx_type *type;
dom.type = LTTNG_DOMAIN_UST;
} else {
ERR("Please specify a tracer (-k/--kernel or -u/--userspace)");
- ret = CMD_UNDEFINED;
+ ret = CMD_ERROR;
goto error;
}
opt_channel_name);
if (ret < 0) {
ERR("%s: ", type->opt->symbol);
+ warn = 1;
continue;
} else {
MSG("%s context %s added to %s event in %s",
error:
lttng_destroy_handle(handle);
+ /*
+ * This means that at least one add_context failed and tells the user to
+ * look on stderr for error(s).
+ */
+ if (warn) {
+ ret = CMD_WARNING;
+ }
return ret;
}
if (strcmp(argv[0], cmd->name) == 0) {
ret = cmd->func(argc, (const char**) argv);
switch (ret) {
+ case CMD_WARNING:
+ WARN("Some command(s) went wrong");
+ break;
case CMD_ERROR:
ERR("Command error");
break;