Make execution path with uninitialized domain fail
[lttng-tools.git] / src / bin / lttng / commands / list.c
index c0bd30f2245a1a3597e9e9699d500d925ea0a249..7c33046ebec1490f798ca4a63e71f0778f91c1db 100644 (file)
@@ -196,11 +196,10 @@ static void print_events(struct lttng_event *event)
        switch (event->type) {
        case LTTNG_EVENT_TRACEPOINT:
        {
-               MSG("%s%s%s%s%d%s (type: tracepoint)%s", indent6,
+               MSG("%s%s%s%s%s (type: tracepoint)%s", indent6,
                                event->name,
                                loglevel_string_pre(event->loglevel),
                                loglevel_string(event->loglevel),
-                               event->loglevel,
                                loglevel_string_post(event->loglevel),
                                enabled_string(event->enabled));
                break;
@@ -247,6 +246,8 @@ static int list_ust_events(void)
        struct lttng_event *event_list;
        pid_t cur_pid = 0;
 
+       memset(&domain, 0, sizeof(domain));
+
        DBG("Getting UST tracing events");
 
        domain.type = LTTNG_DOMAIN_UST;
@@ -296,6 +297,8 @@ static int list_kernel_events(void)
        struct lttng_handle *handle;
        struct lttng_event *event_list;
 
+       memset(&domain, 0, sizeof(domain));
+
        DBG("Getting kernel tracing events");
 
        domain.type = LTTNG_DOMAIN_KERNEL;
@@ -557,6 +560,8 @@ int cmd_list(int argc, const char **argv)
        struct lttng_domain domain;
        struct lttng_domain *domains = NULL;
 
+       memset(&domain, 0, sizeof(domain));
+
        if (argc < 1) {
                usage(stderr);
                ret = CMD_ERROR;
@@ -593,6 +598,10 @@ int cmd_list(int argc, const char **argv)
        } else if (opt_userspace) {
                DBG2("Listing userspace global domain");
                domain.type = LTTNG_DOMAIN_UST;
+       } else {
+               usage(stderr);
+               ret = CMD_UNDEFINED;
+               goto end;
        }
 
        handle = lttng_create_handle(session_name, &domain);
This page took 0.023336 seconds and 4 git commands to generate.