From d7686e24cfe55e4797bb0ed7ad44893793373cfb Mon Sep 17 00:00:00 2001 From: David Goulet Date: Mon, 25 Mar 2013 16:15:37 -0400 Subject: [PATCH] Fix: add missing error output Signed-off-by: David Goulet --- src/bin/lttng/commands/create.c | 3 +++ src/bin/lttng/commands/destroy.c | 5 +++++ src/bin/lttng/commands/disable_events.c | 2 +- src/bin/lttng/commands/list.c | 12 ++++++++---- 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/bin/lttng/commands/create.c b/src/bin/lttng/commands/create.c index fe659d087..bf24b6675 100644 --- a/src/bin/lttng/commands/create.c +++ b/src/bin/lttng/commands/create.c @@ -351,6 +351,9 @@ static int create_session(void) case LTTNG_ERR_EXIST_SESS: WARN("Session %s already exists", session_name); break; + default: + ERR("%s", lttng_strerror(ret)); + break; } goto error; } diff --git a/src/bin/lttng/commands/destroy.c b/src/bin/lttng/commands/destroy.c index f26da0669..3fb5fb232 100644 --- a/src/bin/lttng/commands/destroy.c +++ b/src/bin/lttng/commands/destroy.c @@ -78,6 +78,7 @@ static int destroy_session(const char *session_name) WARN("Session name %s not found", session_name); break; default: + ERR("%s", lttng_strerror(ret)); break; } goto error; @@ -103,7 +104,11 @@ static int destroy_all_sessions() count = lttng_list_sessions(&sessions); if (count == 0) { MSG("No session found, nothing to do."); + } else if (count < 0) { + ERR("%s", lttng_strerror(ret)); + goto error; } + for (i = 0; i < count; i++) { ret = destroy_session(sessions[i].name); if (ret < 0) { diff --git a/src/bin/lttng/commands/disable_events.c b/src/bin/lttng/commands/disable_events.c index b238b9d60..c3a0f1da9 100644 --- a/src/bin/lttng/commands/disable_events.c +++ b/src/bin/lttng/commands/disable_events.c @@ -126,7 +126,7 @@ static int disable_events(char *session_name) if (opt_disable_all) { ret = lttng_disable_event(handle, NULL, channel_name); if (ret < 0) { - /* Don't set ret so lttng can interpret the sessiond error. */ + ERR("%s", lttng_strerror(ret)); goto error; } diff --git a/src/bin/lttng/commands/list.c b/src/bin/lttng/commands/list.c index 4df363d6b..e0ea6748f 100644 --- a/src/bin/lttng/commands/list.c +++ b/src/bin/lttng/commands/list.c @@ -318,7 +318,7 @@ static int list_ust_events(void) size = lttng_list_tracepoints(handle, &event_list); if (size < 0) { - ERR("Unable to list UST events"); + ERR("Unable to list UST events: %s", lttng_strerror(size)); lttng_destroy_handle(handle); return size; } @@ -375,7 +375,7 @@ static int list_ust_event_fields(void) size = lttng_list_tracepoint_fields(handle, &event_field_list); if (size < 0) { - ERR("Unable to list UST event fields"); + ERR("Unable to list UST event fields: %s", lttng_strerror(size)); lttng_destroy_handle(handle); return size; } @@ -434,7 +434,7 @@ static int list_kernel_events(void) size = lttng_list_tracepoints(handle, &event_list); if (size < 0) { - ERR("Unable to list kernel events"); + ERR("Unable to list kernel events: %s", lttng_strerror(size)); lttng_destroy_handle(handle); return size; } @@ -468,6 +468,7 @@ static int list_events(const char *channel_name) count = lttng_list_events(handle, channel_name, &events); if (count < 0) { ret = count; + ERR("%s", lttng_strerror(ret)); goto error; } @@ -540,6 +541,7 @@ static int list_channels(const char *channel_name) /* We had a real error */ ret = count; ERR("%s", lttng_strerror(ret)); + break; } goto error_channels; } @@ -561,7 +563,7 @@ static int list_channels(const char *channel_name) /* Listing events per channel */ ret = list_events(channels[i].name); if (ret < 0) { - MSG("%s", lttng_strerror(ret)); + ERR("%s", lttng_strerror(ret)); } if (chan_found) { @@ -660,6 +662,7 @@ static int list_domains(const char *session_name) count = lttng_list_domains(session_name, &domains); if (count < 0) { ret = count; + ERR("%s", lttng_strerror(ret)); goto error; } else if (count == 0) { MSG(" None"); @@ -796,6 +799,7 @@ int cmd_list(int argc, const char **argv) nb_domain = lttng_list_domains(session_name, &domains); if (nb_domain < 0) { ret = nb_domain; + ERR("%s", lttng_strerror(ret)); goto end; } -- 2.34.1