diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-11 20:23:41 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-01-11 20:23:41 +0000 |
commit | 04a6bd3b96fa24767d02235d9df4c2211c4f5b90 (patch) | |
tree | cf481a9582a100d36e7b5550911a8a5e1dc172a7 /base/file_util_win.cc | |
parent | 3f22bb5fd055f7d81851d3cf9854acd206490833 (diff) | |
download | chromium_src-04a6bd3b96fa24767d02235d9df4c2211c4f5b90.zip chromium_src-04a6bd3b96fa24767d02235d9df4c2211c4f5b90.tar.gz chromium_src-04a6bd3b96fa24767d02235d9df4c2211c4f5b90.tar.bz2 |
Fix an error when calling ReplaceFile for files on a Windows file share.
Add debugging code to get more info about further issues I couldn't reproduce
and fix yet.
TEST=none
BUG=19607
Review URL: http://codereview.chromium.org/541004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@35934 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/file_util_win.cc')
-rw-r--r-- | base/file_util_win.cc | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/base/file_util_win.cc b/base/file_util_win.cc index b7424c0..9133e7b 100644 --- a/base/file_util_win.cc +++ b/base/file_util_win.cc @@ -125,8 +125,11 @@ bool ReplaceFile(const FilePath& from_path, const FilePath& to_path) { FILE_ATTRIBUTE_NORMAL, NULL); if (target_file != INVALID_HANDLE_VALUE) ::CloseHandle(target_file); - return ::ReplaceFile(to_path.value().c_str(), from_path.value().c_str(), - NULL, 0, NULL, NULL) ? true : false; + // When writing to a network share, we may not be able to change the ACLs. + // Ignore ACL errors then (REPLACEFILE_IGNORE_MERGE_ERRORS). + return ::ReplaceFile(to_path.value().c_str(), + from_path.value().c_str(), NULL, + REPLACEFILE_IGNORE_MERGE_ERRORS, NULL, NULL) ? true : false; } bool CopyFile(const FilePath& from_path, const FilePath& to_path) { @@ -463,12 +466,16 @@ bool CreateTemporaryFileInDir(const FilePath& dir, FilePath* temp_file) { wchar_t temp_name[MAX_PATH + 1]; - if (!GetTempFileName(dir.value().c_str(), L"", 0, temp_name)) - return false; // fail! + if (!GetTempFileName(dir.value().c_str(), L"", 0, temp_name)) { + PLOG(WARNING) << "Failed to get temporary file name in " << dir.value(); + return false; + } DWORD path_len = GetLongPathName(temp_name, temp_name, MAX_PATH); - if (path_len > MAX_PATH + 1 || path_len == 0) - return false; // fail! + if (path_len > MAX_PATH + 1 || path_len == 0) { + PLOG(WARNING) << "Failed to get long path name for " << temp_name; + return false; + } std::wstring temp_file_str; temp_file_str.assign(temp_name, path_len); |