From: Jérémie Galarneau Date: Wed, 11 Sep 2019 00:04:33 +0000 (-0400) Subject: Fix: unreported error in relay_close_trace_chunk X-Git-Tag: v2.11.0-rc4~61 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=91fe0613754c503a81b8d1c59002595647f34148;p=lttng-tools.git Fix: unreported error in relay_close_trace_chunk 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 --- diff --git a/src/bin/lttng-relayd/main.c b/src/bin/lttng-relayd/main.c index 2ffa75078..62a5bd7ce 100644 --- a/src/bin/lttng-relayd/main.c +++ b/src/bin/lttng-relayd/main.c @@ -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; }