nb_chan = session->kernel_session->channel_count;
}
DBG3("Number of kernel channels %zd", nb_chan);
+ if (nb_chan <= 0) {
+ ret = LTTCOMM_KERN_CHAN_NOT_FOUND;
+ }
break;
case LTTNG_DOMAIN_UST:
if (session->ust_session != NULL) {
session->ust_session->domain_global.channels);
}
DBG3("Number of UST global channels %zd", nb_chan);
+ if (nb_chan <= 0) {
+ ret = LTTCOMM_UST_CHAN_NOT_FOUND;
+ }
break;
default:
*channels = NULL;
list_lttng_channels(domain, session, *channels);
} else {
*channels = NULL;
+ /* Ret value was set in the domain switch case */
+ goto error;
}
return nb_chan;
#include "../command.h"
+#include <common/sessiond-comm/sessiond-comm.h>
+
static int opt_userspace;
static int opt_kernel;
static char *opt_channel;
count = lttng_list_channels(handle, &channels);
if (count < 0) {
- ret = count;
+ switch (-count) {
+ case LTTCOMM_KERN_CHAN_NOT_FOUND:
+ ret = CMD_SUCCESS;
+ WARN("No kernel channel");
+ break;
+ case LTTCOMM_UST_CHAN_NOT_FOUND:
+ ret = CMD_SUCCESS;
+ WARN("No UST channel");
+ break;
+ default:
+ /* We had a real error */
+ ret = count;
+ ERR("%s", lttng_strerror(ret));
+ }
goto error_channels;
- } else if (count == 0) {
- ERR("Channel %s not found", channel_name);
- goto error;
}
if (channel_name == NULL) {