[lttng-dev] [lttng-tools PATCH] Small fix to lttng list session

David Goulet david.goulet at polymtl.ca
Wed Feb 15 12:05:10 EST 2012


It's now merged:

d32fb0935e594470f6a7e9ff0797ef101c500797

Thanks
David

On 12-02-14 05:35 PM, David Goulet wrote:
> 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 at ericsson.com>
> Signed-off-by: David Goulet<dgoulet at efficios.com>
> ---
>   src/bin/lttng-sessiond/main.c |    2 +-
>   src/bin/lttng/commands/list.c |    4 ++++
>   2 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/src/bin/lttng-sessiond/main.c b/src/bin/lttng-sessiond/main.c
> index 6c4b8ec..e44209a 100644
> --- a/src/bin/lttng-sessiond/main.c
> +++ b/src/bin/lttng-sessiond/main.c
> @@ -3478,7 +3478,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;
> +			ret = LTTCOMM_OK;
>   			session_unlock_list();
>   			goto error;
>   		}
> diff --git a/src/bin/lttng/commands/list.c b/src/bin/lttng/commands/list.c
> index 9375838..f1707fc 100644
> --- a/src/bin/lttng/commands/list.c
> +++ b/src/bin/lttng/commands/list.c
> @@ -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:

-- 
David Goulet
LTTng project, École Polytechnique de Montréal



More information about the lttng-dev mailing list