diff options
Diffstat (limited to 'include/perfetto/ext/base/thread_utils.h')
-rw-r--r-- | include/perfetto/ext/base/thread_utils.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/perfetto/ext/base/thread_utils.h b/include/perfetto/ext/base/thread_utils.h index 2e9c4e54e..4a1f0b665 100644 --- a/include/perfetto/ext/base/thread_utils.h +++ b/include/perfetto/ext/base/thread_utils.h @@ -20,6 +20,7 @@ #include <string> #include "perfetto/base/build_config.h" +#include "perfetto/ext/base/string_utils.h" #if PERFETTO_BUILDFLAG(PERFETTO_OS_LINUX) || \ PERFETTO_BUILDFLAG(PERFETTO_OS_ANDROID) || \ @@ -46,8 +47,7 @@ namespace base { // string. inline bool MaybeSetThreadName(const std::string& name) { char buf[16] = {}; - size_t sz = std::min(name.size(), static_cast<size_t>(15)); - strncpy(buf, name.c_str(), sz); + StringCopy(buf, name.c_str(), sizeof(buf)); #if PERFETTO_BUILDFLAG(PERFETTO_OS_APPLE) return pthread_setname_np(buf) == 0; |