Skip to content

Commit

Permalink
Use a 16-byte buffer for pthread_setname_np()
Browse files Browse the repository at this point in the history
Signed-off-by: Richard Yao <ryao@gentoo.org>
  • Loading branch information
ryao committed Oct 16, 2014
1 parent 738b9a9 commit 0e67649
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/libzpool/kernel.c
Expand Up @@ -148,6 +148,7 @@ zk_thread_create(caddr_t stk, size_t stksize, thread_func_t func,
kthread_t *kt;
pthread_attr_t attr;
char *stkstr;
char short_name[16];

ASSERT0(state & ~TS_RUN);

Expand Down Expand Up @@ -183,7 +184,8 @@ zk_thread_create(caddr_t stk, size_t stksize, thread_func_t func,
VERIFY0(pthread_create(&kt->t_tid, &attr, &zk_thread_helper, kt));
VERIFY0(pthread_attr_destroy(&attr));

VERIFY0(pthread_setname_np(kt->t_tid, name));
(void) snprintf(short_name, sizeof(short_name), "%s", name);
VERIFY0(pthread_setname_np(kt->t_tid, short_name));

return (kt);
}
Expand Down

0 comments on commit 0e67649

Please sign in to comment.