Fix: error on no/multiple domain options
[lttng-tools.git] / src / bin / lttng / commands / enable_events.c
index 6ebf89f72f757565dd0edf98f154e338c2fcae4b..2fc24c5cce0807fc957128120117bcb64d3a8def 100644 (file)
@@ -676,9 +676,8 @@ static int enable_events(char *session_name)
                /* Default. */
                dom.buf_type = LTTNG_BUFFER_PER_UID;
        } else {
-               print_missing_domain();
-               ret = CMD_ERROR;
-               goto error;
+               /* Checked by the caller. */
+               assert(0);
        }
 
        if (opt_exclude) {
@@ -1105,9 +1104,7 @@ static int enable_events(char *session_name)
                        strncpy(ev.name, event_name, LTTNG_SYMBOL_NAME_LEN);
                        ev.name[LTTNG_SYMBOL_NAME_LEN - 1] = '\0';
                } else {
-                       print_missing_domain();
-                       ret = CMD_ERROR;
-                       goto error;
+                       assert(0);
                }
 
                if (!opt_filter) {
@@ -1388,6 +1385,13 @@ int cmd_enable_events(int argc, const char **argv)
                }
        }
 
+       ret = print_missing_or_multiple_domains(
+               opt_kernel + opt_userspace + opt_jul + opt_log4j);
+       if (ret) {
+               ret = CMD_ERROR;
+               goto end;
+       }
+
        /* Mi check */
        if (lttng_opt_mi) {
                writer = mi_lttng_writer_create(fileno(stdout), lttng_opt_mi);
This page took 0.023881 seconds and 4 git commands to generate.