fix return value checks of cbfstool's writerom

Signed-off-by: Stefan Reinauer <stepan@coresystems.de>
Acked-by: Stefan Reinauer <stepan@coresystems.de>



git-svn-id: svn://svn.coreboot.org/coreboot/trunk@5644 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
This commit is contained in:
Stefan Reinauer
2010-06-24 13:37:59 +00:00
committed by Stefan Reinauer
parent 980a69b8c2
commit 9bb0438535
3 changed files with 21 additions and 6 deletions

View File

@ -90,11 +90,23 @@ void *loadrom(const char *filename)
return romarea;
}
void writerom(const char *filename, void *start, uint32_t size)
int writerom(const char *filename, void *start, uint32_t size)
{
FILE *file = fopen(filename, "wb");
fwrite(start, size, 1, file);
if (!file) {
fprintf(stderr, "Could not open '%s' for writing: ", filename);
perror("");
return 1;
}
if (fwrite(start, size, 1, file) != 1) {
fprintf(stderr, "Could not write to '%s': ", filename);
perror("");
return 1;
}
fclose(file);
return 0;
}
int cbfs_file_header(uint32_t physaddr)