Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(279)

Unified Diff: net/disk_cache/blockfile/mapped_file.cc

Issue 2404823002: Fix error handling in POSIX version of the base::File::GetLength. (Closed)
Patch Set: Fix error handling in POSIX version of the base::File::GetLength. Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/disk_cache/blockfile/mapped_file.cc
diff --git a/net/disk_cache/blockfile/mapped_file.cc b/net/disk_cache/blockfile/mapped_file.cc
index b2fedd2c787a418f244c90526b06c559f7911631..ae2bd327b2e82dfe37caf3ee60eda5a542d47411 100644
--- a/net/disk_cache/blockfile/mapped_file.cc
+++ b/net/disk_cache/blockfile/mapped_file.cc
@@ -23,6 +23,8 @@ bool MappedFile::Store(const FileBlock* block) {
bool MappedFile::Preload() {
size_t file_len = GetLength();
+ if (!file_len)
danakj 2016/11/29 01:48:01 I don't think this is strictly needed. Reading 0 i
+ return false;
std::unique_ptr<char[]> buf(new char[file_len]);
if (!Read(buf.get(), file_len, 0))
return false;

Powered by Google App Engine
This is Rietveld 408576698