Fix: add missing error output
authorDavid Goulet <dgoulet@efficios.com>
Mon, 25 Mar 2013 20:15:37 +0000 (16:15 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Mon, 25 Mar 2013 20:31:45 +0000 (16:31 -0400)
Signed-off-by: David Goulet <dgoulet@efficios.com>
src/bin/lttng/commands/create.c
src/bin/lttng/commands/destroy.c
src/bin/lttng/commands/disable_events.c
src/bin/lttng/commands/list.c

index fe659d08747394de4d62cd2ea7da8c030513ef26..bf24b6675f3b7e25bfc44300380b6d9e7029919f 100644 (file)
@@ -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;
        }
index f26da066977da67bc0fe945d55a7162cfc08196d..3fb5fb232edb16184a4a7574de9b6e623668959f 100644 (file)
@@ -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) {
index b238b9d60ed42c38c447be06d823a2278db32678..c3a0f1da9abd7a91874b13ff74bdab0d2902b157 100644 (file)
@@ -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;
                }
 
index 4df363d6baab06b233854cc332459d1f47b1ec00..e0ea6748f82a626e212f6decda5b3c0a5fcc776d 100644 (file)
@@ -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;
                        }
 
This page took 0.029672 seconds and 4 git commands to generate.