X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng%2Fcommands%2Fcalibrate.c;h=61b588e1294eead110e14bb5e043f0d74318b065;hb=255a5dabcee8a4b0cfd5062955063110d46f36f4;hp=2c1adb16c747d46ba2f7d2c27db1051ea94656b3;hpb=af87c45a6179026e263c3a9eb251ccf8ec9537e7;p=lttng-tools.git diff --git a/src/bin/lttng/commands/calibrate.c b/src/bin/lttng/commands/calibrate.c index 2c1adb16c..61b588e12 100644 --- a/src/bin/lttng/commands/calibrate.c +++ b/src/bin/lttng/commands/calibrate.c @@ -127,6 +127,9 @@ static int calibrate_lttng(void) struct lttng_domain dom; struct lttng_calibrate calibrate; + memset(&dom, 0, sizeof(dom)); + memset(&calibrate, 0, sizeof(calibrate)); + /* Create lttng domain */ if (opt_kernel) { dom.type = LTTNG_DOMAIN_KERNEL; @@ -134,7 +137,7 @@ static int calibrate_lttng(void) dom.type = LTTNG_DOMAIN_UST; } else { ERR("Please specify a tracer (-k/--kernel or -u/--userspace)"); - ret = CMD_UNDEFINED; + ret = CMD_ERROR; goto error; } @@ -156,7 +159,6 @@ static int calibrate_lttng(void) calibrate.type = LTTNG_CALIBRATE_FUNCTION; ret = lttng_calibrate(handle, &calibrate); if (ret < 0) { - ret = CMD_ERROR; goto error; } MSG("%s calibration done", opt_kernel ? "Kernel" : "UST"); @@ -182,10 +184,12 @@ error: /* * Calibrate LTTng tracer. + * + * Returns a CMD_* error. */ int cmd_calibrate(int argc, const char **argv) { - int opt, ret; + int opt, ret = CMD_SUCCESS; static poptContext pc; pc = poptGetContext(NULL, argc, argv, long_options, 0); @@ -198,7 +202,6 @@ int cmd_calibrate(int argc, const char **argv) switch (opt) { case OPT_HELP: usage(stdout); - ret = CMD_SUCCESS; goto end; case OPT_TRACEPOINT: ret = CMD_UNDEFINED; @@ -223,7 +226,6 @@ int cmd_calibrate(int argc, const char **argv) break; case OPT_LIST_OPTIONS: list_cmd_options(stdout, long_options); - ret = CMD_SUCCESS; goto end; default: usage(stderr); @@ -235,5 +237,6 @@ int cmd_calibrate(int argc, const char **argv) ret = calibrate_lttng(); end: + poptFreeContext(pc); return ret; }