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

Unified Diff: net/disk_cache/blockfile/mapped_file_posix.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_posix.cc
diff --git a/net/disk_cache/blockfile/mapped_file_posix.cc b/net/disk_cache/blockfile/mapped_file_posix.cc
index 99cf49c1890dfbd5d474460666aaa3bc420d170a..2eee9dceb8214715bb82c5a017e8ef83be58b4c7 100644
--- a/net/disk_cache/blockfile/mapped_file_posix.cc
+++ b/net/disk_cache/blockfile/mapped_file_posix.cc
@@ -19,8 +19,11 @@ void* MappedFile::Init(const base::FilePath& name, size_t size) {
return NULL;
size_t temp_len = size ? size : 4096;
- if (!size)
+ if (!size) {
size = GetLength();
+ if (!size)
+ return NULL;
danakj 2016/11/29 01:48:01 same same
+ }
buffer_ = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED,
platform_file(), 0);

Powered by Google App Engine
This is Rietveld 408576698