summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordpranke@chromium.org <dpranke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-05 03:26:16 +0000
committerdpranke@chromium.org <dpranke@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-05 03:26:16 +0000
commite3e9b5e80a05c69714a8942fc941dd58dfb50017 (patch)
tree99012d45995fda15adaf2cf48fd5507e151487ed
parentb4b3ca91faef2219ef7044bc68338b6e794703ac (diff)
downloadchromium_src-e3e9b5e80a05c69714a8942fc941dd58dfb50017.zip
chromium_src-e3e9b5e80a05c69714a8942fc941dd58dfb50017.tar.gz
chromium_src-e3e9b5e80a05c69714a8942fc941dd58dfb50017.tar.bz2
Change default fopen() on Windows from fopen_s() to fsopen(,,_SH_DENYNO).
fopen_s() won't let you open a file that is open by another process. This has the unfortunate property of triggering a race condition in Python exposed by running run-webkit-tests using a lot of threads and spawning off image_diff. There doesn't seem to be a good reason to disallow files that are open in other processes, so I'm changing this. BUG=none TEST=run_webkit_tests doesn't produce "image_diff: can't open file" errors R=darin@chromium.org Review URL: http://codereview.chromium.org/668022 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40710 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/file_util_win.cc12
1 files changed, 2 insertions, 10 deletions
diff --git a/base/file_util_win.cc b/base/file_util_win.cc
index 8f76c5c..d1cdc6c 100644
--- a/base/file_util_win.cc
+++ b/base/file_util_win.cc
@@ -609,19 +609,11 @@ bool SetLastModifiedTime(const FilePath& file_path, base::Time last_modified) {
FILE* OpenFile(const FilePath& filename, const char* mode) {
std::wstring w_mode = ASCIIToWide(std::string(mode));
- FILE* file;
- if (_wfopen_s(&file, filename.value().c_str(), w_mode.c_str()) != 0) {
- return NULL;
- }
- return file;
+ return _wfsopen(filename.value().c_str(), w_mode.c_str(), _SH_DENYNO);
}
FILE* OpenFile(const std::string& filename, const char* mode) {
- FILE* file;
- if (fopen_s(&file, filename.c_str(), mode) != 0) {
- return NULL;
- }
- return file;
+ return _fsopen(filename.c_str(), mode, _SH_DENYNO);
}
int ReadFile(const FilePath& filename, char* data, int size) {