X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fadd_context.c;h=1fce4428c8377b95624a8531cd5106d6b8a0f8be;hb=a95d283a20a012b9e85d520911b4b520fda5aa43;hp=e50ed84b6e97b9e0e7756ebf4b4a8c3b1bcaffba;hpb=89b725777551ead53c60d1bd56ee7182fe539251;p=lttng-tools.git diff --git a/src/bin/lttng/commands/add_context.c b/src/bin/lttng/commands/add_context.c index e50ed84b6..1fce4428c 100644 --- a/src/bin/lttng/commands/add_context.c +++ b/src/bin/lttng/commands/add_context.c @@ -16,6 +16,7 @@ */ #define _GNU_SOURCE +#define _LGPL_SOURCE #include #include #include @@ -24,6 +25,7 @@ #include #include #include +#include #include @@ -567,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); @@ -715,9 +715,9 @@ int cmd_add_context(int argc, const char **argv) goto end; } - type = malloc(sizeof(struct ctx_type)); + type = zmalloc(sizeof(struct ctx_type)); if (type == NULL) { - perror("malloc ctx_type"); + PERROR("malloc ctx_type"); ret = CMD_FATAL; goto end; } @@ -748,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);