X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Fintegrity.c;h=6d007fef93f825c6922b07b6d0ee0b18eaf37ba4;hb=efe0c3f69a5d3c7c226a66c004b5bf6ef8a02d11;hp=7502b6d2a6cc177a643a2bbd4ee17f02835ff8b2;hpb=278506b38274ba91e6c4537f230ebf6478e0322c;p=wimlib diff --git a/src/integrity.c b/src/integrity.c index 7502b6d2..6d007fef 100644 --- a/src/integrity.c +++ b/src/integrity.c @@ -313,9 +313,7 @@ calculate_integrity_table(struct filedes *in_fd, * * Return values: * WIMLIB_ERR_SUCCESS (0) - * WIMLIB_ERR_INVALID_INTEGRITY_TABLE * WIMLIB_ERR_NOMEM - * WIMLIB_ERR_READ * WIMLIB_ERR_UNEXPECTED_END_OF_FILE * WIMLIB_ERR_WRITE */ @@ -328,16 +326,12 @@ write_integrity_table(WIMStruct *wim, struct integrity_table *old_table; struct integrity_table *new_table; int ret; - off_t cur_offset; u32 new_table_size; wimlib_assert(old_lookup_table_end <= new_lookup_table_end); - cur_offset = wim->out_fd.offset; - - if (wim->hdr.integrity.offset == 0 || old_lookup_table_end == 0) { - old_table = NULL; - } else { + old_table = NULL; + if (wim_has_integrity_table(wim) && old_lookup_table_end != 0) { ret = read_integrity_table(wim, old_lookup_table_end - WIM_HEADER_DISK_SIZE, &old_table); @@ -480,7 +474,7 @@ check_wim_integrity(WIMStruct *wim, wimlib_progress_func_t progress_func) struct integrity_table *table; u64 end_lookup_table_offset; - if (wim->hdr.integrity.offset == 0) { + if (!wim_has_integrity_table(wim)) { DEBUG("No integrity information."); return WIM_INTEGRITY_NONEXISTENT; }