X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fadd_context.c;h=a7ab4268ac5401805d83d675639962d834f0fb50;hp=73aff31130e8e5e5f5489d988bff3583ae8ecc86;hb=d16c1a4ce20ed71733c02353383f1a3058fe9ed2;hpb=3183dbb0b0a687ececcadb3be0cde938dc19f57a diff --git a/src/bin/lttng/commands/add_context.c b/src/bin/lttng/commands/add_context.c index 73aff3113..a7ab4268a 100644 --- a/src/bin/lttng/commands/add_context.c +++ b/src/bin/lttng/commands/add_context.c @@ -361,7 +361,7 @@ end: */ 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; @@ -373,7 +373,7 @@ static int add_context(char *session_name) dom.type = LTTNG_DOMAIN_UST; } else { ERR("Please specify a tracer (-k/--kernel or -u/--userspace)"); - ret = CMD_UNDEFINED; + ret = CMD_ERROR; goto error; } @@ -404,6 +404,7 @@ static int add_context(char *session_name) 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", @@ -418,6 +419,13 @@ static int add_context(char *session_name) 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; }