Fix: error on no/multiple domain options
[lttng-tools.git] / src / bin / lttng / commands / disable_channels.c
index 7ae2ed79ad9439f036d2b1606581174321ba290c..6bb123fc72a71ea3a29e0a74fca174f437a0676c 100644 (file)
@@ -16,6 +16,7 @@
  */
 
 #define _GNU_SOURCE
+#define _LGPL_SOURCE
 #include <popt.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -110,7 +111,7 @@ static int mi_partial_channel_print(char *channel_name, unsigned int enabled,
 
        /* Success ? */
        ret = mi_lttng_writer_write_element_bool(writer,
-                       mi_lttng_element_command, success);
+                       mi_lttng_element_success, success);
        if (ret) {
                goto end;
        }
@@ -142,9 +143,8 @@ static int disable_channels(char *session_name)
        } else if (opt_userspace) {
                dom.type = LTTNG_DOMAIN_UST;
        } else {
-               print_missing_domain();
-               ret = CMD_ERROR;
-               goto error;
+               /* Checked by the caller. */
+               assert(0);
        }
 
        handle = lttng_create_handle(session_name, &dom);
@@ -179,7 +179,8 @@ static int disable_channels(char *session_name)
                         * Mi:
                         * We assume that if an error occurred the channel is still active.
                         * This might not be the case but is a good assumption.
-                        * The client should look at the stderr stream for more informations.
+                        * The client should look at the stderr stream
+                        * for more informations.
                         */
                        enabled = 1;
                        success = 0;
@@ -259,6 +260,12 @@ int cmd_disable_channels(int argc, const char **argv)
                }
        }
 
+       ret = print_missing_or_multiple_domains(opt_kernel + opt_userspace);
+       if (ret) {
+               ret = CMD_ERROR;
+               goto end;
+       }
+
        opt_channels = (char*) poptGetArg(pc);
        if (opt_channels == NULL) {
                ERR("Missing channel name(s).\n");
This page took 0.023537 seconds and 4 git commands to generate.