Write fileobject contents to file */
| 452 | |
| 453 | /* Write fileobject contents to file */ |
| 454 | static int write_file(const char *filename, const struct fileobject *fo) |
| 455 | { |
| 456 | FILE *fd_out = fopen(filename, "wb"); |
| 457 | |
| 458 | if (!fd_out) { |
| 459 | printerr("%s open failed: %s\n", filename, strerror(errno)); |
| 460 | return 1; |
| 461 | } |
| 462 | if (fwrite(fo->data, 1, fo->size, fd_out) != fo->size) { |
| 463 | fclose(fd_out); |
| 464 | return 1; |
| 465 | } |
| 466 | return fclose(fd_out); |
| 467 | } |
| 468 | |
| 469 | /* dump VBT contents in human readable form */ |
| 470 | static void dump_vbt(const struct fileobject *fo) |