Fix dalvik's use of readdir_r(3).
Change-Id: Ic2c9b88b2b3204b4c02f4838766dc4d9ebad06a2
diff --git a/vm/Thread.cpp b/vm/Thread.cpp
index 7f6f583..2676ca4 100644
--- a/vm/Thread.cpp
+++ b/vm/Thread.cpp
@@ -3488,13 +3488,12 @@
snprintf(path, sizeof(path), "/proc/%d/task", getpid());
DIR* d = opendir(path);
- if (d) {
- dirent de;
- dirent* result;
+ if (d != NULL) {
+ dirent* entry = NULL;
bool first = true;
- while (!readdir_r(d, &de, &result) && result) {
+ while ((entry = readdir(d)) != NULL) {
char* end;
- pid_t tid = strtol(de.d_name, &end, 10);
+ pid_t tid = strtol(entry->d_name, &end, 10);
if (!*end && !isDalvikThread(tid)) {
if (first) {
dvmPrintDebugMessage(target, "NATIVE THREADS:\n");