Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0c419d1a authored by Hans Boehm's avatar Hans Boehm Committed by Automerger Merge Worker
Browse files

Merge "Correct off-by-one error in SetThreadName" am: bb1686a6 am:...

Merge "Correct off-by-one error in SetThreadName" am: bb1686a6 am: 8da7bd5d am: d497310b am: 14de9cb2

Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/2019395

Change-Id: I66611f03692a0a843b09a6d5c01016b1ae8a0bb9
parents 76357ef5 14de9cb2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -895,7 +895,7 @@ void SetThreadName(const std::string& thread_name) {

  // pthread_setname_np fails rather than truncating long strings.
  char buf[16];       // MAX_TASK_COMM_LEN=16 is hard-coded into bionic
  strlcpy(buf, name_start_ptr, sizeof(buf) - 1);
  strlcpy(buf, name_start_ptr, sizeof(buf));
  errno = pthread_setname_np(pthread_self(), buf);
  if (errno != 0) {
    ALOGW("Unable to set the name of current thread to '%s': %s", buf, strerror(errno));