From b69133401acc92e8b947c81e365872ebab0c9aa8 Mon Sep 17 00:00:00 2001 From: David Goulet Date: Thu, 2 Feb 2012 11:47:31 -0500 Subject: [PATCH] Fix session listing msg when session name not found Signed-off-by: David Goulet --- src/bin/lttng/commands/list.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/bin/lttng/commands/list.c b/src/bin/lttng/commands/list.c index 3bac86ecd..c0bd30f22 100644 --- a/src/bin/lttng/commands/list.c +++ b/src/bin/lttng/commands/list.c @@ -480,7 +480,8 @@ static int list_sessions(const char *session_name) continue; } - MSG(" %d) %s (%s)%s", i + 1, sessions[i].name, sessions[i].path, active_string(sessions[i].enabled)); + MSG(" %d) %s (%s)%s", i + 1, sessions[i].name, sessions[i].path, + active_string(sessions[i].enabled)); if (session_found) { break; @@ -490,7 +491,9 @@ static int list_sessions(const char *session_name) free(sessions); if (!session_found && session_name != NULL) { - ERR("Session %s not found", session_name); + ERR("Session '%s' not found", session_name); + ret = CMD_ERROR; + goto error; } if (session_name == NULL) { @@ -601,7 +604,7 @@ int cmd_list(int argc, const char **argv) if (session_name == NULL) { if (!opt_kernel && !opt_userspace) { ret = list_sessions(NULL); - if (ret < 0) { + if (ret != 0) { goto end; } } @@ -620,7 +623,7 @@ int cmd_list(int argc, const char **argv) } else { /* List session attributes */ ret = list_sessions(session_name); - if (ret < 0) { + if (ret != 0) { goto end; } -- 2.34.1