Fix: incorrect error message on metadata missing argument
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 30 Aug 2018 18:45:23 +0000 (14:45 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 13 Sep 2018 21:30:57 +0000 (17:30 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng/commands/metadata.c

index 08d6e5894cdf8366b215329789e03616cd75d944..9d4be2b81a0b648061f9cb9ef45113550f3154e6 100644 (file)
@@ -76,12 +76,14 @@ static int metadata_regenerate(int argc, const char **argv)
        int ret;
 
        if (argc > 1) {
-               ret = -LTTNG_ERR_INVALID;
+               ret = CMD_UNDEFINED;
                goto end;
        }
        ret = lttng_regenerate_metadata(session_name);
        if (ret == 0) {
                MSG("Metadata successfully regenerated for session %s", session_name);
+       } else {
+               ERR("%s", lttng_strerror(ret));
        }
 
 end:
@@ -94,8 +96,8 @@ static int handle_command(const char **argv)
        int ret = CMD_SUCCESS, i = 0, argc, command_ret = CMD_SUCCESS;
 
        if (argv == NULL) {
-               ERR("argv is null");
-               command_ret = CMD_ERROR;
+               ERR("No action specified for metadata command.");
+               ret = CMD_ERROR;
                goto end;
        }
 
@@ -215,12 +217,7 @@ int cmd_metadata(int argc, const char **argv)
 
        command_ret = handle_command(poptGetArgs(pc));
        if (command_ret) {
-               switch (-command_ret) {
-               default:
-                       ERR("%s", lttng_strerror(command_ret));
-                       success = 0;
-                       break;
-               }
+               success = 0;
        }
 
        if (lttng_opt_mi) {
This page took 0.02705 seconds and 4 git commands to generate.