summaryrefslogtreecommitdiffstats
path: root/net/disk_cache/backend_impl.cc
diff options
context:
space:
mode:
authorrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-23 01:36:31 +0000
committerrvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-23 01:36:31 +0000
commit5acb2cb8eed3ef2f6c244e13e2a0e39e607ab63f (patch)
tree609ed7d87013488724369da8c29f5a794d94e7e9 /net/disk_cache/backend_impl.cc
parent147479d5e94f4c091b62c69a76bdfe6b6e15f39a (diff)
downloadchromium_src-5acb2cb8eed3ef2f6c244e13e2a0e39e607ab63f.zip
chromium_src-5acb2cb8eed3ef2f6c244e13e2a0e39e607ab63f.tar.gz
chromium_src-5acb2cb8eed3ef2f6c244e13e2a0e39e607ab63f.tar.bz2
Disk cache: Make sure we don't overwrite external files when creating new ones.
TEST=unit test git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1270 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache/backend_impl.cc')
-rw-r--r--net/disk_cache/backend_impl.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc
index 9b15d5e..6abcd94c 100644
--- a/net/disk_cache/backend_impl.cc
+++ b/net/disk_cache/backend_impl.cc
@@ -576,7 +576,7 @@ bool BackendImpl::CreateExternalFile(Addr* address) {
int file_number = data_->header.last_file + 1;
Addr file_address(0);
bool success = false;
- for (int i = 0; (i < 0x0fffffff) && !success; i++) {
+ for (int i = 0; (i < 0x0fffffff) && !success; i++, file_number++) {
if (!file_address.SetFileNumber(file_number)) {
file_number = 1;
continue;
@@ -584,7 +584,7 @@ bool BackendImpl::CreateExternalFile(Addr* address) {
std::wstring name = GetFileName(file_address);
scoped_refptr<disk_cache::File> file(
new disk_cache::File(CreateOSFile(name.c_str(), OS_FILE_READ |
- OS_FILE_WRITE |OS_FILE_SHARE_READ | OS_FILE_CREATE_ALWAYS, NULL)));
+ OS_FILE_WRITE |OS_FILE_SHARE_READ | OS_FILE_CREATE, NULL)));
if (!file->IsValid())
continue;