X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=lttng%2Fcommands%2Fstop.c;h=b40a63881b297188efc2a074bdefcd4a3c4cdcfa;hp=87862b4b905dcc049fd8c77703a9fd9693b02841;hb=cd80958d00fddabced5fbd60641978516a01e29e;hpb=8b270bdb4dccf5571180a9906084126e90eec949 diff --git a/lttng/commands/stop.c b/lttng/commands/stop.c index 87862b4b9..b40a63881 100644 --- a/lttng/commands/stop.c +++ b/lttng/commands/stop.c @@ -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; }