Chromium Code Reviews| 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); |