- /*
- * The active path for the next rotation/destroy.
- * Ex: ~/lttng-traces/auto-20170922-111748/20170922-111754-42
- */
- ret = snprintf(session->rotation_chunk.active_tracing_path,
- sizeof(session->rotation_chunk.active_tracing_path),
- "%s/%s-%" PRIu64,
- session_get_base_path(session),
- datetime, session->current_archive_id + 1);
- if (ret < 0 || ret == sizeof(session->rotation_chunk.active_tracing_path)) {
- ERR("Failed to format active kernel tracing path in rotate session command");
- cmd_ret = LTTNG_ERR_UNK;
- goto error;
- }
- /*
- * The sub-directory for the consumer
- * Ex: /20170922-111754-42/kernel
- */
- ret = snprintf(session->kernel_session->consumer->chunk_path,
- sizeof(session->kernel_session->consumer->chunk_path),
- "/%s-%" PRIu64, datetime,
- session->current_archive_id + 1);
- if (ret < 0 || ret == sizeof(session->kernel_session->consumer->chunk_path)) {
- ERR("Failed to format the kernel consumer's sub-directory in rotate session command");
+ ret = lttng_strncpy(
+ session->kernel_session->consumer->chunk_path,
+ session->consumer->chunk_path,
+ sizeof(session->kernel_session->consumer->chunk_path));
+ if (ret) {
+ ERR("Failed to copy current chunk directory to kernel session");