Index: base/files/file_enumerator_posix.cc |
diff --git a/base/files/file_enumerator_posix.cc b/base/files/file_enumerator_posix.cc |
index fb4010aadcad566f304a899344f1cb892b666081..16a04801c3ae450f5ad6c88a02571f12f5cdabde 100644 |
--- a/base/files/file_enumerator_posix.cc |
+++ b/base/files/file_enumerator_posix.cc |
@@ -131,9 +131,11 @@ bool FileEnumerator::ReadDirectory(std::vector<FileInfo>* entries, |
additional space for pathname may be needed |
#endif |
- struct dirent dent_buf; |
- struct dirent* dent; |
- while (readdir_r(dir, &dent_buf, &dent) == 0 && dent) { |
+ // In all implementations of the C library that Chromium can run with, |
+ // concurrent calls to readdir that specify different directory streams are |
+ // thread-safe. This is the case here, since the directory stream is scoped to |
+ // the current function. See https://codereview.chromium.org/2411833004/#msg3 |
+ for (struct dirent* dent = readdir(dir); dent; dent = readdir(dir)) { |
FileInfo info; |
info.filename_ = FilePath(dent->d_name); |