diff --git a/sched/pthread/pthread_create.c b/sched/pthread/pthread_create.c index 648a8529388..cd9868a6714 100644 --- a/sched/pthread/pthread_create.c +++ b/sched/pthread/pthread_create.c @@ -26,7 +26,6 @@ #include #include -#include #include #include #include @@ -59,6 +58,16 @@ const pthread_attr_t g_default_pthread_attr = PTHREAD_ATTR_INITIALIZER; +/**************************************************************************** + * Private Data + ****************************************************************************/ + +#if CONFIG_TASK_NAME_SIZE > 0 +/* This is the name for name-less pthreads */ + +static const char g_pthreadname[] = ""; +#endif + /**************************************************************************** * Private Functions ****************************************************************************/ @@ -92,8 +101,8 @@ static inline void pthread_tcb_setup(FAR struct pthread_tcb_s *ptcb, #if CONFIG_TASK_NAME_SIZE > 0 /* Copy the pthread name into the TCB */ - snprintf(ptcb->cmn.name, CONFIG_TASK_NAME_SIZE, - "pt-%p", ptcb->cmn.entry.pthread); + strncpy(ptcb->cmn.name, g_pthreadname, CONFIG_TASK_NAME_SIZE); + ptcb->cmn.name[CONFIG_TASK_NAME_SIZE] = '\0'; #endif /* CONFIG_TASK_NAME_SIZE */ /* For pthreads, args are strictly pass-by-value; that actual