X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Flib%2Flttng-ctl%2Flttng-ctl.c;h=033a28105ef6744f464434c32ad0f01b2ada889c;hp=d8d5db6c7ff6838d087309c421c83cb919e0758c;hb=850767541647c102a299d7fbc39c97555ac70224;hpb=b0a5f0fbc428de5cd15a5c86f95a12f32e8c3c88 diff --git a/src/lib/lttng-ctl/lttng-ctl.c b/src/lib/lttng-ctl/lttng-ctl.c index d8d5db6c7..033a28105 100644 --- a/src/lib/lttng-ctl/lttng-ctl.c +++ b/src/lib/lttng-ctl/lttng-ctl.c @@ -640,9 +640,14 @@ int lttng_add_context(struct lttng_handle *handle, 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); @@ -671,9 +676,9 @@ int lttng_enable_event(struct lttng_handle *handle, 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, @@ -800,9 +805,15 @@ int lttng_enable_event_with_filter(struct lttng_handle *handle, 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)); @@ -855,11 +866,12 @@ int lttng_disable_event(struct lttng_handle *handle, const char *name, 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)); }