Small fix to lttng list session
authorDavid Goulet <dgoulet@efficios.com>
Tue, 14 Feb 2012 22:31:57 +0000 (17:31 -0500)
committerDavid Goulet <dgoulet@efficios.com>
Tue, 14 Feb 2012 23:30:07 +0000 (18:30 -0500)
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>
src/bin/lttng-sessiond/main.c
src/bin/lttng/commands/list.c

index 6c4b8ec5ce4c94a26b14c33f44839938f8bdd7ac..6ae374483a428019721591fc012924044eb93758 100644 (file)
@@ -3477,11 +3477,7 @@ static int process_client_msg(struct command_ctx *cmd_ctx)
 
                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();
index 93758381c9678a9afb5554c9d220d9776f272afd..f1707fc76844d76d68d43c85e5da0df645c627ec 100644 (file)
@@ -475,6 +475,9 @@ static int list_sessions(const char *session_name)
        if (count < 0) {
                ret = count;
                goto error;
+       } else if (count == 0) {
+               MSG("Currently no available tracing session");
+               goto end;
        }
 
        if (session_name == NULL) {
@@ -512,6 +515,7 @@ static int list_sessions(const char *session_name)
                MSG("\nUse lttng list <session_name> for more details");
        }
 
+end:
        return CMD_SUCCESS;
 
 error:
This page took 0.028699 seconds and 4 git commands to generate.