X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=lttng%2Fcommands%2Fstop.c;h=b40a63881b297188efc2a074bdefcd4a3c4cdcfa;hp=c79a553d1b12c4d999226e265c592757a851719f;hb=4dbd54a14d42213c0b80fa6d797ddd416cd0330d;hpb=82a3637f639486c07ff937ab03e1e9532379d26a diff --git a/lttng/commands/stop.c b/lttng/commands/stop.c index c79a553d1..b40a63881 100644 --- a/lttng/commands/stop.c +++ b/lttng/commands/stop.c @@ -25,9 +25,9 @@ #include #include -#include "cmd.h" -#include "conf.h" -#include "utils.h" +#include "../cmd.h" +#include "../conf.h" +#include "../utils.h" static char *opt_session_name; @@ -35,6 +35,8 @@ enum { OPT_HELP = 1, }; +static struct lttng_handle *handle; + static struct poptOption long_options[] = { /* longName, shortName, argInfo, argPtr, value, descrip, argDesc */ {"help", 'h', POPT_ARG_NONE, 0, OPT_HELP, 0, 0}, @@ -56,9 +58,7 @@ static void usage(FILE *ofp) } /* - * stop_tracing - * - * Start tracing for all trace of the session. + * Start tracing for all trace of the session. */ static int stop_tracing(void) { @@ -75,7 +75,13 @@ static int stop_tracing(void) session_name = opt_session_name; } - ret = lttng_stop_tracing(session_name); + handle = lttng_create_handle(session_name, NULL); + if (handle == NULL) { + ret = -1; + goto error; + } + + ret = lttng_stop_tracing(handle); if (ret < 0) { goto free_name; } @@ -86,7 +92,10 @@ free_name: if (opt_session_name == NULL) { free(session_name); } + error: + lttng_destroy_handle(handle); + return ret; }