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

Unified Diff: data_layout.c

Issue 6368153: Check return code of fwrite in raw image writing code. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/cbootimage.git@master
Patch Set: Fix tab->space Created 9 years, 10 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: data_layout.c
diff --git a/data_layout.c b/data_layout.c
index 3c49f9f20b7d98b4b3277bd8f92726c4792bebf9..139e5376f0e4b29cd0218c28feba25edb2b92fc5 100644
--- a/data_layout.c
+++ b/data_layout.c
@@ -1017,9 +1017,12 @@ write_block_raw(build_image_context *context)
data = empty_blk;
}
/* Write the data */
- fwrite(data, 1,
- pages_to_write * context->page_size,
- context->raw_file);
+ {
+ size_t bytes = pages_to_write * context->page_size;
+
+ if (fwrite(data, 1, bytes, context->raw_file) != bytes)
+ return -1;
+ }
}
free(empty_blk);
« 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