X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fsnapshot.cpp;h=3cb66c5557406ed3585d80f1f4c4185cda51be9e;hp=8e19fa3d86f40f0bca00996793ed15cbab72081c;hb=a9cfc0f36bf8ade64df08392b03a9f15409dc01b;hpb=48a4000561343808724f7cb5fa8c131877489ccd diff --git a/src/bin/lttng/commands/snapshot.cpp b/src/bin/lttng/commands/snapshot.cpp index 8e19fa3d8..3cb66c555 100644 --- a/src/bin/lttng/commands/snapshot.cpp +++ b/src/bin/lttng/commands/snapshot.cpp @@ -15,11 +15,11 @@ #include #include -#include -#include +#include +#include #include -#include "../command.h" +#include "../command.hpp" static const char *opt_session_name; static const char *opt_output_name; @@ -60,7 +60,7 @@ static struct poptOption snapshot_opts[] = { {"name", 'n', POPT_ARG_STRING, &opt_output_name, 0, 0, 0}, {"max-size", 'm', POPT_ARG_STRING, 0, OPT_MAX_SIZE, 0, 0}, {"list-options", 0, POPT_ARG_NONE, NULL, OPT_LIST_OPTIONS, NULL, NULL}, - {"list-commands", 0, POPT_ARG_NONE, NULL, OPT_LIST_COMMANDS}, + {"list-commands", 0, POPT_ARG_NONE, NULL, OPT_LIST_COMMANDS, NULL, NULL}, {0, 0, 0, 0, 0, 0, 0} }; @@ -384,7 +384,8 @@ end: return ret; } -static int cmd_list_output(int argc, const char **argv) +static int cmd_list_output(int argc __attribute__((unused)), + const char **argv __attribute__((unused))) { int ret; @@ -425,8 +426,8 @@ static int record(const char *url) } if (lttng_opt_mi) { - ret = mi_lttng_snapshot_record(writer, current_session_name, url, - opt_ctrl_url, opt_data_url); + ret = mi_lttng_snapshot_record(writer, url, opt_ctrl_url, + opt_data_url); if (ret) { ret = CMD_ERROR; } @@ -622,17 +623,20 @@ int cmd_snapshot(int argc, const char **argv) case OPT_MAX_SIZE: { uint64_t val; - const char *max_size_arg = poptGetOptArg(pc); + char *max_size_arg = poptGetOptArg(pc); + const int parse_ret = utils_parse_size_suffix( + (char *) max_size_arg, &val); - if (utils_parse_size_suffix((char *) max_size_arg, &val) < 0) { + if (parse_ret < 0) { ERR("Unable to handle max-size value %s", max_size_arg); cmd_ret = CMD_ERROR; + free(max_size_arg); goto end; } opt_max_size = val; - + free(max_size_arg); break; } default: