Fix: error on no/multiple domain options
[lttng-tools.git] / src / bin / lttng / commands / disable_events.c
index e833fe9572141baf13c6a47ca7c922fb647d1155..7e84f798a57f746598a8723a02329b7bf13390f8 100644 (file)
@@ -16,6 +16,7 @@
  */
 
 #define _GNU_SOURCE
+#define _LGPL_SOURCE
 #include <popt.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -184,9 +185,8 @@ static int disable_events(char *session_name)
        } else if (opt_python) {
                dom.type = LTTNG_DOMAIN_PYTHON;
        } else {
-               print_missing_domain();
-               ret = CMD_ERROR;
-               goto error;
+               /* Checked by the caller. */
+               assert(0);
        }
 
        channel_name = opt_channel_name;
@@ -221,6 +221,9 @@ static int disable_events(char *session_name)
        }
 
        memset(&event, 0, sizeof(event));
+       /* Set default loglevel to any/unknown */
+       event.loglevel = -1;
+
        switch (opt_event_type) {
        case LTTNG_EVENT_SYSCALL:
                event.type = LTTNG_EVENT_SYSCALL;
@@ -373,6 +376,13 @@ int cmd_disable_events(int argc, const char **argv)
                }
        }
 
+       ret = print_missing_or_multiple_domains(
+               opt_kernel + opt_userspace + opt_jul + opt_log4j + opt_python);
+       if (ret) {
+               ret = CMD_ERROR;
+               goto end;
+       }
+
        opt_event_list = (char*) poptGetArg(pc);
        if (opt_event_list == NULL && opt_disable_all == 0) {
                ERR("Missing event name(s).\n");
This page took 0.02423 seconds and 4 git commands to generate.