am 831789a9: am 6ba555f2: Merge "libutils: Don\'t segfault ProcessCallStack when getting thread name fails" into lmp-dev

* commit '831789a9f257bd929caa2fb927c4b902459cce53':
  libutils: Don't segfault ProcessCallStack when getting thread name fails
This commit is contained in:
Igor Murashkin 2014-08-19 23:57:54 +00:00 committed by Android Git Automerger
commit 613831b958
1 changed files with 5 additions and 0 deletions

View File

@ -90,6 +90,11 @@ static String8 getThreadName(pid_t tid) {
ALOGE("%s: Failed to open %s", __FUNCTION__, path);
}
if (procName == NULL) {
// Reading /proc/self/task/%d/comm failed due to a race
return String8::format("[err-unknown-tid-%d]", tid);
}
// Strip ending newline
strtok(procName, "\n");