static void usage(int status)
{
FILE *stream = (status != EXIT_SUCCESS) ? stderr : stdout;
- struct board_info *board;
fprintf(stream, "Usage: %s [OPTIONS...]\n", progname);
fprintf(stream,
return 0;
}
-static int read_to_buf(struct file_info *fdata, char *buf)
+static int read_to_buf(struct file_info *fdata, uint8_t *buf)
{
FILE *f;
int ret = EXIT_FAILURE;
}
errno = 0;
- fread(buf, fdata->file_size, 1, f);
- if (errno != 0) {
+ ssize_t r = fread(buf, fdata->file_size, 1, f);
+ if (r != 1 || errno != 0) {
ERRS("unable to read from file \"%s\"", fdata->file_name);
goto out_close;
}
return 0;
}
-static int write_fw(char *data, int len)
+static int write_fw(uint8_t *data, int len)
{
FILE *f;
int ret = EXIT_FAILURE;
static int build_fw(void)
{
int buflen;
- char *buf;
- char *p;
+ uint8_t *buf;
+ uint8_t *p;
int ret = EXIT_FAILURE;
- int writelen = 0;
- uint32_t crc;
struct fw_header *hdr;
struct fw_tail *tail;
int main(int argc, char *argv[])
{
int ret = EXIT_FAILURE;
- int err;
-
- FILE *outfile;
-
progname = basename(argv[0]);
while ( 1 ) {