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

Unified Diff: components/safe_browsing_db/v4_store.cc

Issue 2598733002: Fix handling of store-write failures in Pver4 (Closed)
Patch Set: Change the way I generate a non-writable file, for Windows Created 4 years 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
« no previous file with comments | « no previous file | components/safe_browsing_db/v4_store_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/safe_browsing_db/v4_store.cc
diff --git a/components/safe_browsing_db/v4_store.cc b/components/safe_browsing_db/v4_store.cc
index efb548a5bed168fb3f1af74cfe7d0809b08d7aa5..3b7ded7d6b1ee45c8b30fc1f496ade798d3b7e66 100644
--- a/components/safe_browsing_db/v4_store.cc
+++ b/components/safe_browsing_db/v4_store.cc
@@ -738,7 +738,10 @@ StoreWriteResult V4Store::WriteToDisk(const Checksum& checksum) {
file_format.SerializeToString(&file_format_string);
size_t written = base::WriteFile(new_filename, file_format_string.data(),
file_format_string.size());
- DCHECK_EQ(file_format_string.size(), written);
+
+ if (file_format_string.size() != written) {
+ return UNEXPECTED_BYTES_WRITTEN_FAILURE;
+ }
if (!base::Move(new_filename, store_path_)) {
return UNABLE_TO_RENAME_FAILURE;
« no previous file with comments | « no previous file | components/safe_browsing_db/v4_store_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698