Index: net/disk_cache/simple/simple_index_file_posix.cc |
diff --git a/net/disk_cache/simple/simple_index_file_posix.cc b/net/disk_cache/simple/simple_index_file_posix.cc |
index e0dd3dd126a98801b5711eb892d8ca79bd9b3bfc..c49a89dce4ea9603446f846af7e82d104860e143 100644 |
--- a/net/disk_cache/simple/simple_index_file_posix.cc |
+++ b/net/disk_cache/simple/simple_index_file_posix.cc |
@@ -34,18 +34,18 @@ bool SimpleIndexFile::TraverseCacheDirectory( |
PLOG(ERROR) << "opendir " << cache_path.value(); |
return false; |
} |
- dirent entry, *result; |
- while (readdir_r(dir.get(), &entry, &result) == 0) { |
- if (!result) |
- return true; // The traversal completed successfully. |
- const std::string file_name(result->d_name); |
+ errno = 0; |
+ for (dirent* entry = readdir(dir.get()); entry; entry = readdir(dir.get())) { |
+ const std::string file_name(entry->d_name); |
if (file_name == "." || file_name == "..") |
continue; |
const base::FilePath file_path = cache_path.Append( |
base::FilePath(file_name)); |
entry_file_callback.Run(file_path); |
} |
- PLOG(ERROR) << "readdir_r " << cache_path.value(); |
+ if (!errno) |
+ return true; // The traversal completed successfully. |
+ PLOG(ERROR) << "readdir " << cache_path.value(); |
return false; |
} |