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

Unified Diff: runtime/bin/directory_win.cc

Issue 10825413: Don't traverse through junctions when recursively deleting on Windows. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/standalone/io/directory_test.dart » ('j') | tests/standalone/io/directory_test.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/directory_win.cc
diff --git a/runtime/bin/directory_win.cc b/runtime/bin/directory_win.cc
index 7fedd6c0bc9c29acd0c76219b1ced13c475c965f..e655751f86ec1d2c73a96464c925056a1d3e5348 100644
--- a/runtime/bin/directory_win.cc
+++ b/runtime/bin/directory_win.cc
@@ -233,6 +233,16 @@ static bool DeleteEntry(LPWIN32_FIND_DATA find_file_data,
static bool DeleteRecursively(const char* dir_name) {
+ // If the directory is a junction, it's pointing to some other place in the
+ // filesystem that we do not want to recurse into.
+ DWORD attributes = GetFileAttributes(dir_name);
+ if ((attributes != INVALID_FILE_ATTRIBUTES) &&
+ (attributes & FILE_ATTRIBUTE_REPARSE_POINT) != 0) {
+ printf("%s junction\n", dir_name);
Søren Gjesse 2012/08/17 07:07:37 Please remove debug print.
Mads Ager (google) 2012/08/17 07:08:46 Remove debug printing.
Bob Nystrom 2012/08/20 23:24:32 Done.
+ // Just delete the junction itself.
+ return RemoveDirectory(dir_name) != 0;
+ }
+
// Compute full path for the directory currently being deleted. The
// path buffer will be used to construct the current path in the
// recursive traversal. path_length does not always equal
« no previous file with comments | « no previous file | tests/standalone/io/directory_test.dart » ('j') | tests/standalone/io/directory_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698