Fix: goto error_fatal on lttng_ustconsumer_recv_cmd errors
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tue, 18 Jun 2013 19:30:06 +0000 (15:30 -0400)
committerDavid Goulet <dgoulet@efficios.com>
Wed, 19 Jun 2013 18:47:21 +0000 (14:47 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
src/common/ust-consumer/ust-consumer.c

index f7ffb0febf5b7bcdc338b30975ae7e3379724935..cd6277f1aa42995735c95cbdf296e3cec55386cf 100644 (file)
@@ -796,6 +796,9 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                 * The ret value might 0 meaning an orderly shutdown but this is ok
                 * since the caller handles this.
                 */
+               if (ret > 0) {
+                       ret = -1;
+               }
                return ret;
        }
        if (msg.cmd_type == LTTNG_CONSUMER_STOP) {
@@ -871,6 +874,7 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                                sizeof(is_data_pending));
                if (ret < 0) {
                        DBG("Error when sending the data pending ret code: %d", ret);
+                       goto error_fatal;
                }
 
                /*
@@ -977,10 +981,9 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                ret = consumer_send_status_channel(sock, channel);
                if (ret < 0) {
                        /*
-                        * There is probably a problem on the socket so the poll will get
-                        * it and clean everything up.
+                        * There is probably a problem on the socket.
                         */
-                       goto end_nosignal;
+                       goto error_fatal;
                }
 
                break;
@@ -1002,7 +1005,7 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                ret = consumer_send_status_msg(sock, LTTNG_OK);
                if (ret < 0) {
                        /* Somehow, the session daemon is not responding anymore. */
-                       goto end_nosignal;
+                       goto error_fatal;
                }
 
                /* Send everything to sessiond. */
@@ -1098,14 +1101,14 @@ int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
 
                /* Wait for more data. */
                if (lttng_consumer_poll_socket(consumer_sockpoll) < 0) {
-                       goto end_nosignal;
+                       goto error_fatal;
                }
 
                ret = lttng_ustconsumer_recv_metadata(sock, key, offset,
                                len, channel);
                if (ret < 0) {
                        /* error receiving from sessiond */
-                       goto end_nosignal;
+                       goto error_fatal;
                } else {
                        ret_code = ret;
                        goto end_msg_sessiond;
@@ -1140,7 +1143,10 @@ end_msg_sessiond:
         * the caller because the session daemon socket management is done
         * elsewhere. Returning a negative code or 0 will shutdown the consumer.
         */
-       (void) consumer_send_status_msg(sock, ret_code);
+       ret = consumer_send_status_msg(sock, ret_code);
+       if (ret < 0) {
+               goto error_fatal;
+       }
        rcu_read_unlock();
        return 1;
 end_channel_error:
This page took 0.027454 seconds and 4 git commands to generate.