This patch makes lttng_list_sessions return 0 (not an error) when there
is in fact zero registered sessions. Also adding a MSG() to the user to
inform that no sessions exist and the error code is 0.
Reported-by: Tan Dung Le Tran <tan.dung.le.tran@ericsson.com>
Acked-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: David Goulet <dgoulet@efficios.com>
session_lock_list();
nr_sessions = lttng_sessions_count(cmd_ctx->creds.uid, cmd_ctx->creds.gid);
- if (nr_sessions == 0) {
- ret = LTTCOMM_NO_SESSION;
- session_unlock_list();
- goto error;
- }
+
ret = setup_lttng_msg(cmd_ctx, sizeof(struct lttng_session) * nr_sessions);
if (ret < 0) {
session_unlock_list();
if (count < 0) {
ret = count;
goto error;
+ } else if (count == 0) {
+ MSG("Currently no available tracing session");
+ goto end;
}
if (session_name == NULL) {
MSG("\nUse lttng list <session_name> for more details");
}
+end:
return CMD_SUCCESS;
error: