diff options
author | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-13 18:41:58 +0000 |
---|---|---|
committer | rvargas@google.com <rvargas@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-13 18:41:58 +0000 |
commit | e25d44ddde58a2e0fd05fd4e8f9c9632fb7209af (patch) | |
tree | 26054af3acf60a1109f76ba52ff4f827ae205e29 /net/disk_cache/file_posix.cc | |
parent | c369fd304932e51ad62cb3bd9cb5608665518e00 (diff) | |
download | chromium_src-e25d44ddde58a2e0fd05fd4e8f9c9632fb7209af.zip chromium_src-e25d44ddde58a2e0fd05fd4e8f9c9632fb7209af.tar.gz chromium_src-e25d44ddde58a2e0fd05fd4e8f9c9632fb7209af.tar.bz2 |
Disk cache: detect block files that are shorter than expected
and return a proper net error code from async IO.
BUG=88968
TEST=net_unittests
Review URL: http://codereview.chromium.org/7351007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@92390 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/disk_cache/file_posix.cc')
-rw-r--r-- | net/disk_cache/file_posix.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/net/disk_cache/file_posix.cc b/net/disk_cache/file_posix.cc index 6f78b7a..a80ae6c 100644 --- a/net/disk_cache/file_posix.cc +++ b/net/disk_cache/file_posix.cc @@ -8,6 +8,7 @@ #include "base/logging.h" #include "base/threading/worker_pool.h" +#include "net/base/net_errors.h" #include "net/disk_cache/disk_cache.h" #include "net/disk_cache/in_flight_io.h" @@ -92,7 +93,7 @@ void FileBackgroundIO::Read() { if (file_->Read(const_cast<void*>(buf_), buf_len_, offset_)) { result_ = static_cast<int>(buf_len_); } else { - result_ = -1; + result_ = net::ERR_CACHE_READ_FAILURE; } controller_->OnIOComplete(this); } @@ -101,7 +102,7 @@ void FileBackgroundIO::Read() { void FileBackgroundIO::Write() { bool rv = file_->Write(buf_, buf_len_, offset_); - result_ = rv ? static_cast<int>(buf_len_) : -1; + result_ = rv ? static_cast<int>(buf_len_) : net::ERR_CACHE_WRITE_FAILURE; controller_->OnIOComplete(this); } |