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

Unified Diff: mojo/common/data_pipe_utils.cc

Issue 324813007: Fixes warn_unused_result of fwrite. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/common/data_pipe_utils.cc
diff --git a/mojo/common/data_pipe_utils.cc b/mojo/common/data_pipe_utils.cc
index 2722bc3c2176b511c2e9e4af131be2a034b23d57..4ae10857eafbc2b6eb5dab50250d3efda30e7421 100644
--- a/mojo/common/data_pipe_utils.cc
+++ b/mojo/common/data_pipe_utils.cc
@@ -28,9 +28,9 @@ bool BlockingCopyToFile(ScopedDataPipeConsumerHandle source,
MojoResult result = BeginReadDataRaw(source.get(), &buffer, &num_bytes,
MOJO_READ_DATA_FLAG_NONE);
if (result == MOJO_RESULT_OK) {
- fwrite(buffer, 1, num_bytes, fp.get());
+ size_t bytes_written = fwrite(buffer, 1, num_bytes, fp.get());
result = EndReadDataRaw(source.get(), num_bytes);
- if (result != MOJO_RESULT_OK)
+ if (bytes_written < num_bytes || result != MOJO_RESULT_OK)
return false;
} else if (result == MOJO_RESULT_SHOULD_WAIT) {
result = Wait(source.get(),
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698