From aa19e8c60910e0158a475ce0904c97de83bd8ce0 Mon Sep 17 00:00:00 2001 From: backslashxx <118538522+backslashxx@users.noreply.github.com> Date: Fri, 13 Jun 2025 18:56:07 +0800 Subject: [PATCH] kernel: throne_tracker: add strscpy/strlcpy compat MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit strscpy requires 4.3 strscpy on this usage can be replaced with strncpy + null term. kernel gives us an option though. strlcpy is fast af, hotrod fast. It’s just memcpy + null term, so lets go with that. it got dropped in 6.8 due to risk concerns, so for those, lets use og strscpy. Signed-off-by: backslashxx <118538522+backslashxx@users.noreply.github.com> --- kernel/throne_tracker.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/kernel/throne_tracker.c b/kernel/throne_tracker.c index d4c6ba42..97e0337e 100644 --- a/kernel/throne_tracker.c +++ b/kernel/throne_tracker.c @@ -170,7 +170,11 @@ FILLDIR_RETURN_TYPE my_actor(struct dir_context *ctx, const char *name, return FILLDIR_ACTOR_CONTINUE; } +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 8, 0) + strlcpy(data->dirpath, dirpath, DATA_PATH_LEN); +#else strscpy(data->dirpath, dirpath, DATA_PATH_LEN); +#endif data->depth = my_ctx->depth - 1; list_add_tail(&data->list, my_ctx->data_path_list); } else { @@ -260,7 +264,11 @@ void search_manager(const char *path, int depth, struct list_head *uid_data) // First depth struct data_path data; +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 8, 0) + strlcpy(data.dirpath, path, DATA_PATH_LEN); +#else strscpy(data.dirpath, path, DATA_PATH_LEN); +#endif data.depth = depth; list_add_tail(&data.list, &data_path_list);