Skip to content

Commit

Permalink
Apply suggestion from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Adam Johnson <[email protected]>
  • Loading branch information
dgelessus and Hoikas committed Nov 5, 2023
1 parent edffd7f commit bdadd69
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions Sources/Plasma/CoreLib/hsThread_Unix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,7 @@ void hsThread::SetThisThreadName(const ST::string& name)
hsAssert(res == 0, "Failed to set thread name");
#elif defined(HS_BUILD_FOR_LINUX)
// On Linux, thread names must fit into 16 bytes, including the terminator.
char buf[16];
strncpy(buf, name.c_str(), sizeof(buf));
buf[sizeof(buf) - 1] = '\0';
int res = pthread_setname_np(pthread_self(), buf);
int res = pthread_setname_np(pthread_self(), name.left(15).c_str());
hsAssert(res == 0, "Failed to set thread name");
#endif
// Because this is just a debugging help, do nothing by default (sorry, BSDs).
Expand Down

0 comments on commit bdadd69

Please sign in to comment.