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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /** 1 /**
2 * Copyright (c) 2011 NVIDIA Corporation. All rights reserved. 2 * Copyright (c) 2011 NVIDIA Corporation. All rights reserved.
3 * 3 *
4 * See file CREDITS for list of people who contributed to this 4 * See file CREDITS for list of people who contributed to this
5 * project. 5 * project.
6 * 6 *
7 * This program is free software; you can redistribute it and/or 7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as 8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of 9 * published by the Free Software Foundation; either version 2 of
10 * the License, or (at your option) any later version. 10 * the License, or (at your option) any later version.
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after
1010 if (empty_blk == NULL) { 1010 if (empty_blk == NULL) {
1011 empty_blk = malloc(context->block_size); 1011 empty_blk = malloc(context->block_size);
1012 if (!empty_blk) 1012 if (!empty_blk)
1013 return -ENOMEM; 1013 return -ENOMEM;
1014 memset(empty_blk, 0, context->block_size); 1014 memset(empty_blk, 0, context->block_size);
1015 } 1015 }
1016 pages_to_write = context->pages_per_blk; 1016 pages_to_write = context->pages_per_blk;
1017 data = empty_blk; 1017 data = empty_blk;
1018 } 1018 }
1019 /* Write the data */ 1019 /* Write the data */
1020 » » fwrite(data, 1, 1020 » » {
1021 » » » pages_to_write * context->page_size, 1021 » » » size_t bytes = pages_to_write * context->page_size;
1022 » » » context->raw_file); 1022
1023 » » » if (fwrite(data, 1, bytes, context->raw_file) != bytes)
1024 » » » » return -1;
1025 » » }
1023 } 1026 }
1024 1027
1025 free(empty_blk); 1028 free(empty_blk);
1026 return 0; 1029 return 0;
1027 } 1030 }
OLDNEW
« 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