X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fclient.c;h=4cfa60067f2ae31a72b2f97b9cce55437d2cdc20;hb=64defc29e677a20a8ed00d55d9884a77bdc893d2;hp=1bf55f60b7f415afa81274b20af8c54bc09ef9d6;hpb=fe489250ce102edf511e99669025934ec9587c63;p=lttng-tools.git diff --git a/src/bin/lttng-sessiond/client.c b/src/bin/lttng-sessiond/client.c index 1bf55f60b..4cfa60067 100644 --- a/src/bin/lttng-sessiond/client.c +++ b/src/bin/lttng-sessiond/client.c @@ -133,7 +133,10 @@ static int setup_empty_lttng_msg(struct command_ctx *cmd_ctx) int ret; const struct lttcomm_lttng_msg llm = {}; - lttng_dynamic_buffer_set_size(&cmd_ctx->reply_payload.buffer, 0); + ret = lttng_dynamic_buffer_set_size(&cmd_ctx->reply_payload.buffer, 0); + if (ret) { + goto end; + } /* Append place-holder reply header. */ ret = lttng_dynamic_buffer_append( @@ -735,32 +738,10 @@ static int send_unix_sock(int sock, struct lttng_payload_view *view) } if (fd_count > 0) { - int i; - struct lttng_dynamic_array raw_fds; - - /* - * Never holds ownership of the FDs; this is just used - * to put the FDs in a contiguous array. - */ - lttng_dynamic_array_init(&raw_fds, sizeof(int), NULL); - - for (i = 0; i < fd_count; i++) { - struct fd_handle *handle = - lttng_payload_view_pop_fd_handle(view); - const int raw_fd = fd_handle_get_fd(handle); - - ret = lttng_dynamic_array_add_element(&raw_fds, &raw_fd); - fd_handle_put(handle); - if (ret) { - lttng_dynamic_array_reset(&raw_fds); - goto end; - } + ret = lttcomm_send_payload_view_fds_unix_sock(sock, view); + if (ret < 0) { + goto end; } - - ret = lttcomm_send_fds_unix_sock(sock, - (const int *) raw_fds.buffer.data, - fd_count); - lttng_dynamic_array_reset(&raw_fds); } end: