/*
- * Copyright (C) 2011 David Goulet <david.goulet@polymtl.ca>
+ * Copyright (C) 2011 EfficiOS Inc.
*
* SPDX-License-Identifier: GPL-2.0-only
*
#include <stdbool.h>
#include <lttng/lttng.h>
-#include "../command.h"
+#include "../command.hpp"
-#include <common/mi-lttng.h>
-#include <common/sessiond-comm/sessiond-comm.h>
-#include <common/utils.h>
+#include <common/mi-lttng.hpp>
+#include <common/sessiond-comm/sessiond-comm.hpp>
+#include <common/utils.hpp>
-static char *opt_session_name;
static int opt_destroy_all;
static int opt_no_wait;
}
break;
}
- /* fall-through. */
}
+ /* fall-through. */
default:
ERR("%sFailed to get the location of the rotation performed during the session's destruction",
newline_needed ? "\n" : "");
int ret = CMD_SUCCESS , i, command_ret = CMD_SUCCESS, success = 1;
static poptContext pc;
char *session_name = NULL;
+ const char *arg_session_name = NULL;
const char *leftover = NULL;
struct lttng_session *sessions = NULL;
success = 0;
}
} else {
- opt_session_name = (char *) poptGetArg(pc);
+ arg_session_name = poptGetArg(pc);
- if (!opt_session_name) {
+ if (!arg_session_name) {
/* No session name specified, lookup default */
session_name = get_session_name();
+ } else {
+ session_name = strdup(arg_session_name);
if (session_name == NULL) {
- command_ret = CMD_ERROR;
- success = 0;
- goto mi_closing;
+ PERROR("Failed to copy session name");
}
- } else {
- session_name = opt_session_name;
+ }
+
+ if (session_name == NULL) {
+ command_ret = CMD_ERROR;
+ success = 0;
+ goto mi_closing;
}
/* Find the corresponding lttng_session struct */
ret = ret ? ret : -LTTNG_ERR_MI_IO_FAIL;
}
- if (opt_session_name == NULL) {
- free(session_name);
- }
-
+ free(session_name);
free(sessions);
/* Overwrite ret if an error occurred during destroy_session/all */