Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: base/files/file_enumerator_win.cc

Issue 20610004: Base: FileEnumerator should not follow reparse points. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Skip test for XP Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/file_util_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « base/file_util_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698