#include "../command.hpp"
-static char *opt_event_list;
static int opt_kernel;
static char *opt_channel_name;
static char *opt_session_name;
*
* Disabling event using the lttng API.
*/
-static int disable_events(char *session_name)
+static int disable_events(char *session_name, char *event_list)
{
int ret = CMD_SUCCESS, warn = 0, command_ret = CMD_SUCCESS;
int enabled = 1, success = 1;
}
} else {
/* Strip event list */
- event_name = strtok(opt_event_list, ",");
+ event_name = strtok(event_list, ",");
while (event_name != NULL) {
DBG("Disabling event %s", event_name);
int opt, ret = CMD_SUCCESS, command_ret = CMD_SUCCESS, success = 1;
static poptContext pc;
char *session_name = NULL;
+ char *event_list = NULL;
+ const char *arg_event_list = NULL;
const char *leftover = NULL;
int event_type = -1;
goto end;
}
- opt_event_list = (char*) poptGetArg(pc);
- if (opt_event_list == NULL && opt_disable_all == 0) {
+ arg_event_list = poptGetArg(pc);
+ if (arg_event_list == NULL && opt_disable_all == 0) {
ERR("Missing event name(s).\n");
ret = CMD_ERROR;
goto end;
}
+ if (opt_disable_all == 0) {
+ event_list = strdup(arg_event_list);
+ if (event_list == NULL) {
+ PERROR("Failed to copy event name(s)");
+ ret = CMD_ERROR;
+ goto end;
+ }
+ }
+
leftover = poptGetArg(pc);
if (leftover) {
ERR("Unknown argument: %s", leftover);
}
}
- command_ret = disable_events(session_name);
+ command_ret = disable_events(session_name, event_list);
if (command_ret) {
success = 0;
}
free(session_name);
}
+ free(event_list);
+
/* Mi clean-up */
if (writer && mi_lttng_writer_destroy(writer)) {
/* Preserve original error code */