From: Jérémie Galarneau Date: Wed, 30 Jun 2021 22:41:24 +0000 (-0400) Subject: lttng: add-trigger: print generated trigger name X-Git-Tag: v2.13.0-rc3~23 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=7ab22b4cf754b381817018b970742c6b7fdc9d8d;p=lttng-tools.git lttng: add-trigger: print generated trigger name Print the generated trigger name when `add-trigger` succeeds. Also, no message is emited when a trigger is successfully registered as the command will print an error message if any error occurs. There is also no need to parrot the trigger's name if it was specified by the user. Signed-off-by: Jérémie Galarneau Change-Id: I9607fbd358298b036bd533834143eb5e9d185cd0 --- diff --git a/src/bin/lttng/commands/add_trigger.c b/src/bin/lttng/commands/add_trigger.c index e7809dc52..583dd1903 100644 --- a/src/bin/lttng/commands/add_trigger.c +++ b/src/bin/lttng/commands/add_trigger.c @@ -2406,9 +2406,22 @@ int cmd_add_trigger(int argc, const char **argv) if (ret_code != LTTNG_OK) { goto error; } + } else { + if (!name) { + const char *returned_trigger_name; + const enum lttng_trigger_status trigger_status = + lttng_trigger_get_name(trigger, + &returned_trigger_name); + + if (trigger_status != LTTNG_TRIGGER_STATUS_OK) { + WARN("Failed to retrieve the name generated for the added trigger."); + } else { + MSG("Added trigger '%s'.", + returned_trigger_name); + } + } } - MSG("Trigger registered successfully."); ret = 0; goto end;