- /*
- * FIXME replace renamat() use by directory handle
- * wrapper for non-POSIX 2008 systems.
- */
- ret = renameat(session_dirfd, directory_to_rename,
- archived_chunks_directory.value.dirfd,
- archived_chunk_name);
+ ret = lttng_directory_handle_rename_as_user(
+ &trace_chunk->session_output_directory.value,
+ directory_to_rename,
+ &archived_chunks_directory.value,
+ archived_chunk_name,
+ LTTNG_OPTIONAL_GET(trace_chunk->credentials).use_current_user ?
+ NULL :
+ &trace_chunk->credentials.value.user);