X-Git-Url: https://git.liburcu.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Fconsumer%2Fconsumer.cpp;fp=src%2Fcommon%2Fconsumer%2Fconsumer.cpp;h=ed844f8dfd8a4d27826ea6b8644d04fc244b0014;hp=7e7e7d384cd20565e48bf3bad2793a41f31d1ca6;hb=fbd566c25787aa7134e84efcfb7d3569f27d3350;hpb=c91ccadee5bfbc94a95540e17c879ce976caf6a2 diff --git a/src/common/consumer/consumer.cpp b/src/common/consumer/consumer.cpp index 7e7e7d384..ed844f8df 100644 --- a/src/common/consumer/consumer.cpp +++ b/src/common/consumer/consumer.cpp @@ -45,6 +45,7 @@ #include #include #include +#include #include lttng_consumer_global_data the_consumer_data; @@ -1255,11 +1256,17 @@ void lttng_consumer_set_command_sock_path(struct lttng_consumer_local_data *ctx, * Send return code to the session daemon. * If the socket is not defined, we return 0, it is not a fatal error */ -int lttng_consumer_send_error(struct lttng_consumer_local_data *ctx, int cmd) +int lttng_consumer_send_error(struct lttng_consumer_local_data *ctx, + enum lttcomm_return_code error_code) { if (ctx->consumer_error_socket > 0) { + const std::int32_t comm_code = std::int32_t(error_code); + + static_assert( + sizeof(comm_code) >= sizeof(std::underlying_type), + "Fixed-size communication type too small to accomodate lttcomm_return_code"); return lttcomm_send_unix_sock( - ctx->consumer_error_socket, &cmd, sizeof(enum lttcomm_sessiond_command)); + ctx->consumer_error_socket, &comm_code, sizeof(comm_code)); } return 0;