if (fs_file) {
fs_fp = fopen (fs_file, "r");
if (!fs_fp) {
+ fclose(kern_fp);
fatal_error (errno, "Cannot open %s", fs_file);
}
}
/* Open the output file */
out_fp = fopen (output_file, "w+");
if (!out_fp) {
+ fclose(kern_fp);
+ if (fs_fp) {
+ fclose(fs_fp);
+ }
fatal_error (errno, "Cannot open %s", output_file);
}
netgear_checksum_add (&chk_part, (unsigned char *)buf, len);
netgear_checksum_add (&chk_whole, (unsigned char *)buf, len);
}
+ fclose(kern_fp);
hdr->kernel_chksum = netgear_checksum_fini (&chk_part);
message (" Kernel Len: %u", hdr->kernel_len);
message ("Kernel Checksum: 0x%08x", hdr->kernel_chksum);
netgear_checksum_add (&chk_part, (unsigned char *)buf, len);
netgear_checksum_add (&chk_whole, (unsigned char *)buf, len);
}
+ fclose(fs_fp);
hdr->rootfs_chksum = (netgear_checksum_fini (&chk_part));
message (" Rootfs Len: %u", hdr->rootfs_len);
message ("Rootfs Checksum: 0x%08x", hdr->rootfs_chksum);
}
/* Success */
+ fclose(out_fp);
return EXIT_SUCCESS;
}