Skip to content

Commit

Permalink
gen_init_cpio: fixed fwrite warning
Browse files Browse the repository at this point in the history
On compilers with security warnings enabled by default, we get:

usr/gen_init_cpio.c: In function ‘cpio_mkfile’:
usr/gen_init_cpio.c:357: warning: ignoring return value of ‘fwrite’,
                                  declared with attribute warn_unused_result

So check the return value and handle errors accordingly.

Signed-off-by: Mike Frysinger <[email protected]>
Signed-off-by: Michal Marek <[email protected]>
  • Loading branch information
vapier authored and michal42 committed Dec 12, 2009
1 parent d9bdcc7 commit 6d87fea
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion usr/gen_init_cpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,10 @@ static int cpio_mkfile(const char *name, const char *location,
push_pad();

if (size) {
fwrite(filebuf, size, 1, stdout);
if (fwrite(filebuf, size, 1, stdout) != 1) {
fprintf(stderr, "writing filebuf failed\n");
goto error;
}
offset += size;
push_pad();
}
Expand Down

0 comments on commit 6d87fea

Please sign in to comment.