Fix: the return code of lttcomm_send_unix_sock is signed
[lttng-tools.git] / src / common / kernel-consumer / kernel-consumer.c
index bdd5ec86d03d926c45b3bebb54e3a1701e4147c8..a5dcc663d68c67f4b465ecabe70004f682842f3f 100644 (file)
@@ -465,10 +465,10 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
        case LTTNG_CONSUMER_ADD_RELAYD_SOCKET:
        {
                /* Session daemon status message are handled in the following call. */
-               ret = consumer_add_relayd_socket(msg.u.relayd_sock.net_index,
+               consumer_add_relayd_socket(msg.u.relayd_sock.net_index,
                                msg.u.relayd_sock.type, ctx, sock, consumer_sockpoll,
                                &msg.u.relayd_sock.sock, msg.u.relayd_sock.session_id,
-                                msg.u.relayd_sock.relayd_session_id);
+                               msg.u.relayd_sock.relayd_session_id);
                goto end_nosignal;
        }
        case LTTNG_CONSUMER_ADD_CHANNEL:
@@ -983,7 +983,8 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
        }
        case LTTNG_CONSUMER_DISCARDED_EVENTS:
        {
-               uint64_t ret;
+               ssize_t ret;
+               uint64_t count;
                struct lttng_consumer_channel *channel;
                uint64_t id = msg.u.discarded_events.session_id;
                uint64_t key = msg.u.discarded_events.channel_key;
@@ -995,15 +996,15 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                if (!channel) {
                        ERR("Kernel consumer discarded events channel %"
                                        PRIu64 " not found", key);
-                       ret = 0;
+                       count = 0;
                } else {
-                       ret = channel->discarded_events;
+                       count = channel->discarded_events;
                }
 
                health_code_update();
 
                /* Send back returned value to session daemon */
-               ret = lttcomm_send_unix_sock(sock, &ret, sizeof(ret));
+               ret = lttcomm_send_unix_sock(sock, &count, sizeof(count));
                if (ret < 0) {
                        PERROR("send discarded events");
                        goto error_fatal;
@@ -1013,7 +1014,8 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
        }
        case LTTNG_CONSUMER_LOST_PACKETS:
        {
-               uint64_t ret;
+               ssize_t ret;
+               uint64_t count;
                struct lttng_consumer_channel *channel;
                uint64_t id = msg.u.lost_packets.session_id;
                uint64_t key = msg.u.lost_packets.channel_key;
@@ -1025,15 +1027,15 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                if (!channel) {
                        ERR("Kernel consumer lost packets channel %"
                                        PRIu64 " not found", key);
-                       ret = 0;
+                       count = 0;
                } else {
-                       ret = channel->lost_packets;
+                       count = channel->lost_packets;
                }
 
                health_code_update();
 
                /* Send back returned value to session daemon */
-               ret = lttcomm_send_unix_sock(sock, &ret, sizeof(ret));
+               ret = lttcomm_send_unix_sock(sock, &count, sizeof(count));
                if (ret < 0) {
                        PERROR("send lost packets");
                        goto error_fatal;
@@ -1166,7 +1168,6 @@ static int get_index_values(struct ctf_packet_index *index, int infd)
                if (ret == -ENOTTY) {
                        /* Command not implemented by lttng-modules. */
                        index->stream_instance_id = -1ULL;
-                       ret = 0;
                } else {
                        PERROR("kernctl_get_instance_id");
                        goto error;
@@ -1238,7 +1239,6 @@ int update_stream_stats(struct lttng_consumer_stream *stream)
                if (ret == -ENOTTY) {
                        /* Command not implemented by lttng-modules. */
                        seq = -1ULL;
-                       ret = 0;
                } else {
                        PERROR("kernctl_get_sequence_number");
                        goto end;
This page took 0.04466 seconds and 4 git commands to generate.