*
* The consumer socket lock must be held by the caller.
*/
-int consumer_send_fds(struct consumer_socket *sock, int *fds, size_t nb_fd)
+int consumer_send_fds(struct consumer_socket *sock, const int *fds,
+ size_t nb_fd)
{
int ret;
*/
int consumer_send_stream(struct consumer_socket *sock,
struct consumer_output *dst, struct lttcomm_consumer_msg *msg,
- int *fds, size_t nb_fd)
+ const int *fds, size_t nb_fd)
{
int ret;
if (ret < 0) {
ret = -LTTNG_ERR_NOMEM;
goto error;
+ } else if (ret >= sizeof(msg.u.snapshot_channel.pathname)) {
+ ERR("Snapshot path exceeds the maximal allowed length of %zu bytes (%i bytes required) with path \"%s/%s/%s-%s-%" PRIu64 "%s\"",
+ sizeof(msg.u.snapshot_channel.pathname),
+ ret, output->consumer->dst.net.base_dir,
+ output->consumer->subdir,
+ output->name, output->datetime,
+ output->nb_snapshot,
+ session_path);
+ ret = -LTTNG_ERR_SNAPSHOT_FAIL;
+ goto error;
}
} else {
ret = snprintf(msg.u.snapshot_channel.pathname,
if (ret < 0) {
ret = -LTTNG_ERR_NOMEM;
goto error;
+ } else if (ret >= sizeof(msg.u.snapshot_channel.pathname)) {
+ ERR("Snapshot path exceeds the maximal allowed length of %zu bytes (%i bytes required) with path \"%s/%s-%s-%" PRIu64 "%s\"",
+ sizeof(msg.u.snapshot_channel.pathname),
+ ret, output->consumer->dst.session_root_path,
+ output->name, output->datetime, output->nb_snapshot,
+ session_path);
+ ret = -LTTNG_ERR_SNAPSHOT_FAIL;
+ goto error;
}
+
msg.u.snapshot_channel.relayd_id = (uint64_t) -1ULL;
/* Create directory. Ignore if exist. */