From: David Goulet Date: Thu, 2 Feb 2012 16:47:31 +0000 (-0500) Subject: Fix session listing msg when session name not found X-Git-Tag: v2.0-pre19~5 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=b69133401acc92e8b947c81e365872ebab0c9aa8;p=lttng-tools.git Fix session listing msg when session name not found Signed-off-by: David Goulet --- 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; }