OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/files/file_enumerator.h" | 5 #include "base/files/file_enumerator.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/threading/thread_restrictions.h" | 10 #include "base/threading/thread_restrictions.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 if (ShouldSkip(cur_file)) | 126 if (ShouldSkip(cur_file)) |
127 continue; | 127 continue; |
128 | 128 |
129 // Construct the absolute filename. | 129 // Construct the absolute filename. |
130 cur_file = root_path_.Append(find_data_.cFileName); | 130 cur_file = root_path_.Append(find_data_.cFileName); |
131 | 131 |
132 if (find_data_.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { | 132 if (find_data_.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) { |
133 if (recursive_) { | 133 if (recursive_) { |
134 // If |cur_file| is a directory, and we are doing recursive searching, | 134 // If |cur_file| is a directory, and we are doing recursive searching, |
135 // add it to pending_paths_ so we scan it after we finish scanning this | 135 // add it to pending_paths_ so we scan it after we finish scanning this |
136 // directory. | 136 // directory. However, don't do recursion through reparse points or we |
137 pending_paths_.push(cur_file); | 137 // may end up with an infinite cycle. |
| 138 if (!(find_data_.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT)) |
| 139 pending_paths_.push(cur_file); |
138 } | 140 } |
139 if (file_type_ & FileEnumerator::DIRECTORIES) | 141 if (file_type_ & FileEnumerator::DIRECTORIES) |
140 return cur_file; | 142 return cur_file; |
141 } else if (file_type_ & FileEnumerator::FILES) { | 143 } else if (file_type_ & FileEnumerator::FILES) { |
142 return cur_file; | 144 return cur_file; |
143 } | 145 } |
144 } | 146 } |
145 | 147 |
146 return FilePath(); | 148 return FilePath(); |
147 } | 149 } |
148 | 150 |
149 } // namespace base | 151 } // namespace base |
OLD | NEW |