Fix: unreported error in relay_close_trace_chunk
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 11 Sep 2019 00:04:33 +0000 (20:04 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 11 Sep 2019 00:04:33 +0000 (20:04 -0400)
Errors encountered in relay_close_trace_chunk are not reported to the
caller as the 'ret' value is re-used to check for the successful
'append' to a dynamic buffer. Use a separate variable.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-relayd/main.c

index 2ffa75078779b7d0b9986696f5643267ca5ea7aa..62a5bd7cefc16026ff05f3e3741e4b4258837fd1 100644 (file)
@@ -2469,7 +2469,7 @@ static int relay_close_trace_chunk(const struct lttcomm_relayd_hdr *recv_hdr,
                struct relay_connection *conn,
                const struct lttng_buffer_view *payload)
 {
-       int ret = 0;
+       int ret = 0, buf_ret;
        ssize_t send_ret;
        struct relay_session *session = conn->session;
        struct lttcomm_relayd_close_trace_chunk *msg;
@@ -2630,17 +2630,17 @@ end_unlock_session:
 end:
        reply.generic.ret_code = htobe32((uint32_t) reply_code);
        reply.path_length = htobe32((uint32_t) path_length);
-       ret = lttng_dynamic_buffer_append(
+       buf_ret = lttng_dynamic_buffer_append(
                        &reply_payload, &reply, sizeof(reply));
-       if (ret) {
+       if (buf_ret) {
                ERR("Failed to append \"close trace chunk\" command reply header to payload buffer");
                goto end_no_reply;
        }
 
        if (reply_code == LTTNG_OK) {
-               ret = lttng_dynamic_buffer_append(&reply_payload,
+               buf_ret = lttng_dynamic_buffer_append(&reply_payload,
                                closed_trace_chunk_path, path_length);
-               if (ret) {
+               if (buf_ret) {
                        ERR("Failed to append \"close trace chunk\" command reply path to payload buffer");
                        goto end_no_reply;
                }
This page took 0.028016 seconds and 4 git commands to generate.