X-Git-Url: http://git.liburcu.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fadd_context.c;h=eeaaf3a6573dfab855d2c3ef0c2de0f4bbad0faa;hb=b75c559e34d9a9ef06a3ad558f104021547ae4a8;hp=6dc29d0670b3bb5883e7e39b39d2514107eb3b61;hpb=98cf2db15fd1a0d073b9a5f1066e385fcccbee09;p=lttng-tools.git diff --git a/src/bin/lttng/commands/add_context.c b/src/bin/lttng/commands/add_context.c index 6dc29d067..eeaaf3a65 100644 --- a/src/bin/lttng/commands/add_context.c +++ b/src/bin/lttng/commands/add_context.c @@ -25,6 +25,7 @@ #include #include #include +#include #include @@ -568,9 +569,7 @@ static int add_context(char *session_name) } else if (opt_userspace) { dom.type = LTTNG_DOMAIN_UST; } else { - print_missing_domain(); - ret = CMD_ERROR; - goto error; + assert(0); } handle = lttng_create_handle(session_name, &dom); @@ -629,11 +628,11 @@ static int add_context(char *session_name) } else { if (opt_channel_name) { MSG("%s context %s added to channel %s", - opt_kernel ? "kernel" : "UST", type->opt->symbol, + get_domain_str(dom.type), type->opt->symbol, opt_channel_name); } else { MSG("%s context %s added to all channels", - opt_kernel ? "kernel" : "UST", type->opt->symbol) + get_domain_str(dom.type), type->opt->symbol); } success = 1; } @@ -718,7 +717,7 @@ int cmd_add_context(int argc, const char **argv) type = zmalloc(sizeof(struct ctx_type)); if (type == NULL) { - perror("malloc ctx_type"); + PERROR("malloc ctx_type"); ret = CMD_FATAL; goto end; } @@ -749,6 +748,13 @@ int cmd_add_context(int argc, const char **argv) } } + ret = print_missing_or_multiple_domains(opt_kernel + opt_userspace); + + if (ret) { + ret = CMD_ERROR; + goto end; + } + if (!opt_type) { ERR("Missing mandatory -t TYPE"); usage(stderr);