Fix issue with setting of thread name

Only first 3 chars of thread name were getting set
because of incorrect length check. This change fixes the issue.

CRs-Fixed: 2376235

Change-Id: Iba4ad44af2e3bfde8da8ae4efdd4b132299ae9b7
This commit is contained in:
Bhavna Sharma 2019-01-04 17:13:21 -08:00 committed by Gerrit - the friendly Code Review server
parent 3203504a28
commit 2332db20a9

View file

@ -85,8 +85,8 @@ LocThreadDelegate::LocThreadDelegate(LocThread::tCreate creator,
if (mThandle) {
// set thread name
char lname[16];
int len = (sizeof(lname)>sizeof(threadName)) ?
(sizeof(threadName) -1):(sizeof(lname) - 1);
int len = (sizeof(lname) > (strlen(threadName) + 1)) ?
(strlen(threadName)):(sizeof(lname) - 1);
memcpy(lname, threadName, len);
lname[len] = 0;
// set the thread name here