lsm.cmd_type = LTTNG_ADD_CONTEXT;
- /* Copy channel name */
- lttng_ctl_copy_string(lsm.u.context.channel_name, channel_name,
- sizeof(lsm.u.context.channel_name));
+ /* If no channel name, send empty string. */
+ if (channel_name == NULL) {
+ lttng_ctl_copy_string(lsm.u.context.channel_name, "",
+ sizeof(lsm.u.context.channel_name));
+ } else {
+ lttng_ctl_copy_string(lsm.u.context.channel_name, channel_name,
+ sizeof(lsm.u.context.channel_name));
+ }
lttng_ctl_copy_lttng_domain(&lsm.domain, &handle->domain);
memset(&lsm, 0, sizeof(lsm));
- /* If no channel name, we put the default name */
+ /* If no channel name, send empty string. */
if (channel_name == NULL) {
- lttng_ctl_copy_string(lsm.u.enable.channel_name, DEFAULT_CHANNEL_NAME,
+ lttng_ctl_copy_string(lsm.u.enable.channel_name, "",
sizeof(lsm.u.enable.channel_name));
} else {
lttng_ctl_copy_string(lsm.u.enable.channel_name, channel_name,
lsm.cmd_type = LTTNG_ENABLE_EVENT_WITH_FILTER;
- /* Copy channel name */
- lttng_ctl_copy_string(lsm.u.enable.channel_name, channel_name,
- sizeof(lsm.u.enable.channel_name));
+ /* If no channel name, send empty string. */
+ if (channel_name == NULL) {
+ lttng_ctl_copy_string(lsm.u.enable.channel_name, "",
+ sizeof(lsm.u.enable.channel_name));
+ } else {
+ lttng_ctl_copy_string(lsm.u.enable.channel_name, channel_name,
+ sizeof(lsm.u.enable.channel_name));
+ }
+
/* Copy event name */
if (event) {
memcpy(&lsm.u.enable.event, event, sizeof(lsm.u.enable.event));
memset(&lsm, 0, sizeof(lsm));
- if (channel_name) {
- lttng_ctl_copy_string(lsm.u.disable.channel_name, channel_name,
+ /* If no channel name, send empty string. */
+ if (channel_name == NULL) {
+ lttng_ctl_copy_string(lsm.u.disable.channel_name, "",
sizeof(lsm.u.disable.channel_name));
} else {
- lttng_ctl_copy_string(lsm.u.disable.channel_name, DEFAULT_CHANNEL_NAME,
+ lttng_ctl_copy_string(lsm.u.disable.channel_name, channel_name,
sizeof(lsm.u.disable.channel_name));
}