X-Git-Url: https://wimlib.net/git/?a=blobdiff_plain;f=src%2Flookup_table.c;h=36d2d13f69430518dcdafbf59b2649a75af25152;hb=eff67c0d712100642ae6dce8262366eb0c3b911b;hp=142e7e0472f046cb8708faca88e61451d9b28c62;hpb=d0e7f039e4ab206b9fd973c983e3fb841fcd2bf2;p=wimlib diff --git a/src/lookup_table.c b/src/lookup_table.c index 142e7e04..36d2d13f 100644 --- a/src/lookup_table.c +++ b/src/lookup_table.c @@ -99,6 +99,7 @@ clone_lookup_table_entry(const struct lookup_table_entry *old) memcpy(new->attached_buffer, old->attached_buffer, wim_resource_size(old)); break; +#ifdef WITH_NTFS_3G case RESOURCE_IN_NTFS_VOLUME: if (old->ntfs_loc) { struct ntfs_location *loc; @@ -120,6 +121,9 @@ clone_lookup_table_entry(const struct lookup_table_entry *old) loc->stream_name_utf16_num_chars * 2); } break; +#endif + default: + break; } return new; out_free: @@ -215,8 +219,8 @@ static void finalize_lte(struct lookup_table_entry *lte) void lte_decrement_refcnt(struct lookup_table_entry *lte, struct lookup_table *table) { - wimlib_assert(lte); - wimlib_assert(lte->refcnt); + wimlib_assert(lte != NULL); + wimlib_assert(lte->refcnt != 0); if (--lte->refcnt == 0) { lookup_table_unlink(table, lte); #ifdef WITH_FUSE @@ -227,12 +231,11 @@ void lte_decrement_refcnt(struct lookup_table_entry *lte, } #ifdef WITH_FUSE -void lte_decrement_num_opened_fds(struct lookup_table_entry *lte, - struct lookup_table *table) +void lte_decrement_num_opened_fds(struct lookup_table_entry *lte) { - wimlib_assert(lte); - wimlib_assert(lte->num_opened_fds); - if (--lte->num_opened_fds == 0 && lte->refcnt == 0) + wimlib_assert(lte != NULL); + wimlib_assert(lte->num_opened_fds != 0); + if (atomic_dec(<e->num_opened_fds) == 0 && lte->refcnt == 0) finalize_lte(lte); } #endif @@ -332,8 +335,15 @@ int read_lookup_table(WIMStruct *w) goto out_free_cur_entry; } + /* Ordinarily, no two streams should share the same SHA1 message + * digest. However, this constraint can be broken for metadata + * resources--- two identical images will have the same metadata + * resource, but their lookup table entries are not shared. */ duplicate_entry = __lookup_resource(table, cur_entry->hash); - if (duplicate_entry) { + if (duplicate_entry + && !((duplicate_entry->resource_entry.flags & WIM_RESHDR_FLAG_METADATA) + && cur_entry->resource_entry.flags & WIM_RESHDR_FLAG_METADATA)) + { ERROR("The WIM lookup table contains two entries with the " "same SHA1 message digest!"); ERROR("The first entry is:");