Index: base/file_util_posix.cc |
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc |
index 7ef09a200de29c96c1f3f49e7002e50798488ec0..9845f54817d141de36ab5a2fc118fd800b3aeb8e 100644 |
--- a/base/file_util_posix.cc |
+++ b/base/file_util_posix.cc |
@@ -519,7 +519,8 @@ bool CreateNewTempDirectory(const FilePath::StringType& prefix, |
return CreateTemporaryDirInDirImpl(tmpdir, TempFileName(), new_temp_path); |
} |
-bool CreateDirectory(const FilePath& full_path) { |
+bool CreateDirectoryAndGetError(const FilePath& full_path, |
+ base::PlatformFileError* error) { |
base::ThreadRestrictions::AssertIOAllowed(); // For call to mkdir(). |
std::vector<FilePath> subpaths; |
@@ -543,8 +544,12 @@ bool CreateDirectory(const FilePath& full_path) { |
// due to the the directory appearing out of thin air. This can occur if |
// two processes are trying to create the same file system tree at the same |
// time. Check to see if it exists and make sure it is a directory. |
- if (!DirectoryExists(*i)) |
+ int saved_errno = errno; |
+ if (!DirectoryExists(*i)) { |
+ if (error) |
+ *error = base::ErrnoToPlatformFileError(saved_errno); |
return false; |
+ } |
} |
return true; |
} |