diff options
author | dgrogan@chromium.org <dgrogan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-11 03:50:25 +0000 |
---|---|---|
committer | dgrogan@chromium.org <dgrogan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-11 03:50:25 +0000 |
commit | cfd23d243ac040a088c65875aaf779aea0c29125 (patch) | |
tree | d3531b3a563d802eafcbc697f294b053c38aa98e /base/file_util_posix.cc | |
parent | b6847730de55da964055d4965199196e3e6145dc (diff) | |
download | chromium_src-cfd23d243ac040a088c65875aaf779aea0c29125.zip chromium_src-cfd23d243ac040a088c65875aaf779aea0c29125.tar.gz chromium_src-cfd23d243ac040a088c65875aaf779aea0c29125.tar.bz2 |
Make CreateDirectory return an error code instead of just a bool.
Make use of the new error code in IndexedDB, where we'll
histogram which errors can be recovered from by retrying
and which can't.
We're going to try retrying CreateDirectory because LevelDB
doesn't pay attention to what env_->CreateDir returns and a
frequent error on the next operation (locking the lock file)
is that the directory doesn't exist. I want to find out
what's causing the directories to not be created in the
first place, and which errors can be considered ephemeral.
BUG=225051
Review URL: https://chromiumcodereview.appspot.com/15812007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@205386 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util_posix.cc')
-rw-r--r-- | base/file_util_posix.cc | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc index 8723333..5d037bf 100644 --- a/base/file_util_posix.cc +++ b/base/file_util_posix.cc @@ -518,7 +518,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; @@ -542,8 +543,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; } |