diff options
author | dgrogan@chromium.org <dgrogan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-08 22:02:36 +0000 |
---|---|---|
committer | dgrogan@chromium.org <dgrogan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-05-08 22:02:36 +0000 |
commit | 6f539941a6cb93d3630bdb9b4d459cfde6988b71 (patch) | |
tree | 63c5c438d9e373fb79a51faa89d383a301b5307e /base/file_util_posix.cc | |
parent | 3264d16a00887b248d4828dbf136b3d8db8381a6 (diff) | |
download | chromium_src-6f539941a6cb93d3630bdb9b4d459cfde6988b71.zip chromium_src-6f539941a6cb93d3630bdb9b4d459cfde6988b71.tar.gz chromium_src-6f539941a6cb93d3630bdb9b4d459cfde6988b71.tar.bz2 |
Make base:ReplaceFile return an informative error.
It currently just returns true/false to indicate success.
More information to diagnose and log failures would be
helpful in IndexedDB.
This patch also logs the new error when ReplaceFile fails in
IndexedDB.
BUG=229268
Review URL: https://chromiumcodereview.appspot.com/14886003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@199025 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util_posix.cc')
-rw-r--r-- | base/file_util_posix.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc index 8b36812..7ef09a2 100644 --- a/base/file_util_posix.cc +++ b/base/file_util_posix.cc @@ -232,9 +232,15 @@ bool MoveUnsafe(const FilePath& from_path, const FilePath& to_path) { return true; } -bool ReplaceFile(const FilePath& from_path, const FilePath& to_path) { +bool ReplaceFileAndGetError(const FilePath& from_path, + const FilePath& to_path, + base::PlatformFileError* error) { base::ThreadRestrictions::AssertIOAllowed(); - return (rename(from_path.value().c_str(), to_path.value().c_str()) == 0); + if (rename(from_path.value().c_str(), to_path.value().c_str()) == 0) + return true; + if (error) + *error = base::ErrnoToPlatformFileError(errno); + return false; } bool CopyDirectory(const FilePath& from_path, |