1
0
Fork 0
forked from nuttx/nuttx-update

sched/init: Fix the compiler warning

/github/workspace/sources/nuttx/include/nuttx/init.h: In function 'nx_start':
Error: init/nx_start.c:439:7: error: 'strncpy' output truncated copying 8 bytes from a string of length 9 [-Werror=stringop-truncation]
  439 |       strncpy(g_idletcb[i].cmn.name, g_idlename, CONFIG_TASK_NAME_SIZE);
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
This commit is contained in:
Xiang Xiao 2022-03-06 19:58:44 +08:00 committed by Petro Karashchenko
parent a07dc2363e
commit 8fa26944f7

View file

@ -436,8 +436,7 @@ void nx_start(void)
snprintf(g_idletcb[i].cmn.name, CONFIG_TASK_NAME_SIZE, "CPU%d IDLE",
i);
# else
strncpy(g_idletcb[i].cmn.name, g_idlename, CONFIG_TASK_NAME_SIZE);
g_idletcb[i].cmn.name[CONFIG_TASK_NAME_SIZE] = '\0';
strlcpy(g_idletcb[i].cmn.name, g_idlename, CONFIG_TASK_NAME_SIZE);
# endif
/* Configure the task name in the argument list. The IDLE task does