From 60e835ca1712647f501c14bb6b3d20a1c13a110c 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 491ffd548..ee51806ff 100644 --- a/src/bin/lttng/commands/create.c +++ b/src/bin/lttng/commands/create.c @@ -279,6 +279,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 b7c2b6c22..0554732c0 100644 --- a/src/bin/lttng/commands/list.c +++ b/src/bin/lttng/commands/list.c @@ -319,7 +319,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; } @@ -380,7 +380,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; } @@ -441,7 +441,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; } @@ -475,6 +475,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; } @@ -545,6 +546,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; } @@ -566,7 +568,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) { @@ -665,6 +667,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"); @@ -801,6 +804,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