- if (fseeko(fp, cur_offset, SEEK_SET) != 0) {
- ERROR_WITH_ERRNO("Failed to seek to byte %"PRIu64" of WIM to "
- "write integrity table", cur_offset);
- ret = WIMLIB_ERR_WRITE;
- goto out_free_new_table;
- }
-
- if (fwrite(new_table, 1, new_table_size, fp) != new_table_size) {
- ERROR_WITH_ERRNO("Failed to write WIM integrity table");
- ret = WIMLIB_ERR_WRITE;
- } else {
- integrity_res_entry->offset = cur_offset;
- integrity_res_entry->size = new_table_size;
- integrity_res_entry->original_size = new_table_size;
- integrity_res_entry->flags = 0;
- ret = 0;
- }
-out_free_new_table:
+ ret = write_wim_resource_from_buffer(new_table,
+ new_table_size,
+ 0,
+ &wim->out_fd,
+ WIMLIB_COMPRESSION_TYPE_NONE,
+ 0,
+ &wim->hdr.integrity_table_reshdr,
+ NULL,
+ 0);