Fix: lttng: add-trigger: don't provide a default event rule type
[lttng-tools.git] / src / bin / lttng / commands / add_trigger.c
index e4111eba095a494987f60740a1e191b921fd3973..c73154b041c3c97314f5539654354b83f9f99320 100644 (file)
@@ -18,6 +18,7 @@
 #include "common/mi-lttng.h"
 #include "common/string-utils/string-utils.h"
 #include "common/utils.h"
+#include <lttng/domain-internal.h>
 /* For lttng_event_rule_type_str(). */
 #include <lttng/event-rule/event-rule-internal.h>
 #include <lttng/lttng.h>
@@ -831,7 +832,8 @@ struct parse_event_rule_res parse_event_rule(int *argc, const char ***argv)
        }
 
        if (event_rule_type == LTTNG_EVENT_RULE_TYPE_UNKNOWN) {
-               event_rule_type = LTTNG_EVENT_RULE_TYPE_USER_TRACEPOINT;
+               ERR("Event rule requires a --type.");
+               goto error;
        }
 
        /*
@@ -2428,7 +2430,7 @@ error:
 
 end:
        /* Mi closing. */
-       if (lttng_opt_mi) {
+       if (lttng_opt_mi && mi_writer) {
                int mi_ret;
 
                /* Close output element. */
This page took 0.023699 seconds and 4 git commands to generate.