X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fmetadata.c;h=f36be65fd3b66a76a31d1a3cc74486d30f8159ba;hp=08d6e5894cdf8366b215329789e03616cd75d944;hb=405f9e7db1cd7c023614ae249f0705fbb3da514c;hpb=eded6438f3b15eccc391525f653e03293a890d32 diff --git a/src/bin/lttng/commands/metadata.c b/src/bin/lttng/commands/metadata.c index 08d6e5894..f36be65fd 100644 --- a/src/bin/lttng/commands/metadata.c +++ b/src/bin/lttng/commands/metadata.c @@ -1,18 +1,8 @@ /* - * Copyright (C) 2015 - Julien Desfossez + * Copyright (C) 2015 Julien Desfossez * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2 only, - * as published by the Free Software Foundation. + * SPDX-License-Identifier: GPL-2.0-only * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #define _LGPL_SOURCE @@ -33,6 +23,12 @@ static char *session_name = NULL; static int metadata_regenerate(int argc, const char **argv); +#ifdef LTTNG_EMBED_HELP +static const char help_msg[] = +#include +; +#endif + enum { OPT_HELP = 1, OPT_LIST_OPTIONS, @@ -76,12 +72,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,12 +92,13 @@ 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; } argc = count_arguments(argv); + assert(argc >= 1); cmd = &actions[i]; while (cmd->func != NULL) { @@ -215,12 +214,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) {