Merge "libutils: Don't segfault ProcessCallStack when getting thread name fails" into lmp-dev

This commit is contained in:
Igor Murashkin 2014-08-19 23:06:56 +00:00 committed by Android (Google) Code Review
commit 6ba555f2ad

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");