Cleanup: unused assignment of ret_code in ROTATE_CHANNEL
[lttng-tools.git] / src / common / kernel-consumer / kernel-consumer.c
index ec67e316d714bc1dc030dfb54b065f7e18352360..87ade12fa33a32e71dd52cc685a6f3acb02e967b 100644 (file)
@@ -644,7 +644,8 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                                msg.u.stream.cpu,
                                &alloc_ret,
                                channel->type,
-                               channel->monitor);
+                               channel->monitor,
+                               msg.u.stream.trace_archive_id);
                if (new_stream == NULL) {
                        switch (alloc_ret) {
                        case -ENOMEM:
@@ -1150,7 +1151,6 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                                msg.u.rotate_channel.key, ctx);
                if (ret < 0) {
                        ERR("Rotate ready streams failed");
-                       ret_code = LTTCOMM_CONSUMERD_CHAN_NOT_FOUND;
                }
 
                break;
@@ -1182,19 +1182,20 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
        }
        case LTTNG_CONSUMER_ROTATE_PENDING_RELAY:
        {
+               int pending;
                uint32_t pending_reply;
 
                DBG("Consumer rotate pending on relay for session %" PRIu64,
                                msg.u.rotate_pending_relay.session_id);
-               ret = lttng_consumer_rotate_pending_relay(
+               pending = lttng_consumer_rotate_pending_relay(
                                msg.u.rotate_pending_relay.session_id,
                                msg.u.rotate_pending_relay.relayd_id,
                                msg.u.rotate_pending_relay.chunk_id);
-               if (ret < 0) {
+               if (pending < 0) {
                        ERR("Rotate pending relay failed");
                        ret_code = LTTCOMM_CONSUMERD_CHAN_NOT_FOUND;
                } else {
-                       pending_reply = !!ret;
+                       pending_reply = !!pending;
                }
 
                health_code_update();
@@ -1205,6 +1206,15 @@ int lttng_kconsumer_recv_cmd(struct lttng_consumer_local_data *ctx,
                        goto end_nosignal;
                }
 
+               if (pending < 0) {
+                       /*
+                        * An error occured while running the command;
+                        * don't send the 'pending' flag as the sessiond
+                        * will not read it.
+                        */
+                       break;
+               }
+
                /* Send back returned value to session daemon */
                ret = lttcomm_send_unix_sock(sock, &pending_reply,
                                sizeof(pending_reply));
This page took 0.027039 seconds and 5 git commands to generate.