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:14 +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 491ffd548ae6deb11c149f5819b572e98981052c..ee51806ff5685b7ab374a1688b2c9e760ebe76a4 100644 (file)
@@ -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;
        }
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 b7c2b6c2263cdae040bedd6ccc4e4527ff47fdd2..0554732c0ea60318d8b3811f21d45eb94b9bd92a 100644 (file)
@@ -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;
                        }
 
This page took 0.028729 seconds and 4 git commands to generate.