summaryrefslogtreecommitdiffstats
path: root/base/file_util_win.cc
diff options
context:
space:
mode:
authorhuanr@chromium.org <huanr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-17 20:42:40 +0000
committerhuanr@chromium.org <huanr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-17 20:42:40 +0000
commit89b9ae090d3d32dc5462e3c1d15b1a5d67f63e6a (patch)
treeef9962f91283d24ea61cfd780eda05e82544d640 /base/file_util_win.cc
parenta1b508bd812fd58321587869d1ba94e5994756a4 (diff)
downloadchromium_src-89b9ae090d3d32dc5462e3c1d15b1a5d67f63e6a.zip
chromium_src-89b9ae090d3d32dc5462e3c1d15b1a5d67f63e6a.tar.gz
chromium_src-89b9ae090d3d32dc5462e3c1d15b1a5d67f63e6a.tar.bz2
Fix a regression introduced by r33225.
On windows, if CreateDirectory is called with an path on an inaccessible drive, it will enter an infinite loop. BUG=30415 TEST=base_unittests.exe --gtest_filter=FileUtilTest.CreateDirectoryTest Review URL: http://codereview.chromium.org/500075 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34871 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util_win.cc')
-rw-r--r--base/file_util_win.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/base/file_util_win.cc b/base/file_util_win.cc
index 6dfc049..b7424c0 100644
--- a/base/file_util_win.cc
+++ b/base/file_util_win.cc
@@ -528,7 +528,11 @@ bool CreateDirectory(const FilePath& full_path) {
// Attempt to create the parent recursively. This will immediately return
// true if it already exists, otherwise will create all required parent
// directories starting with the highest-level missing parent.
- if (!CreateDirectory(full_path.DirName())) {
+ FilePath parent_path(full_path.DirName());
+ if (parent_path.value() == full_path.value()) {
+ return false;
+ }
+ if (!CreateDirectory(parent_path)) {
DLOG(WARNING) << "Failed to create one of the parent directories.";
return false;
}