License header fixes
[lttng-tools.git] / src / bin / lttng / commands / calibrate.c
index a3c7b5241a03cc0d539e94688f8698c4ebf07c7d..a14570eea5e3341b173595ff91c07323e66d2cbb 100644 (file)
@@ -2,19 +2,18 @@
  * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca>
  * Copyright (C) 2011 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; only version 2
- * of the License.
+ * 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.
  *
  * 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., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ * 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 _GNU_SOURCE
@@ -127,6 +126,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;
@@ -156,7 +158,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 +183,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 +201,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 +225,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 +236,6 @@ int cmd_calibrate(int argc, const char **argv)
        ret = calibrate_lttng();
 
 end:
+       poptFreeContext(pc);
        return ret;
 }
This page took 0.025391 seconds and 5 git commands to generate.