X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=src%2Fresource.c;h=e29434fc295bee0592bf09205ff0748b839f3ee6;hp=b525f22873e0acec892296e970ad54c7eff9c3f9;hb=751a849fe04a9230a661e38429ff4d971f74bdbf;hpb=f988d892c603e72d1c0a722c2b02b2418ff68c1e;ds=sidebyside diff --git a/src/resource.c b/src/resource.c index b525f228..e29434fc 100644 --- a/src/resource.c +++ b/src/resource.c @@ -1112,8 +1112,6 @@ int write_file_resource(struct dentry *dentry, void *wim_p) struct lookup_table_entry *lte; int in_wim_ctype; int out_wim_ctype; - int input_res_ctype; - struct resource_entry *input_res_entry; struct resource_entry *output_res_entry; u64 len; int ret; @@ -1138,6 +1136,10 @@ int write_file_resource(struct dentry *dentry, void *wim_p) out_wim_ctype = wimlib_get_compression_type(w); output_res_entry = <e->output_resource_entry; + /* do not write empty resources */ + if (lte->resource_entry.original_size == 0) + return 0; + /* Figure out if we can read the resource from the WIM file, or * if we have to read it from the filesystem outside. */ if (lte->file_on_disk) { @@ -1175,15 +1177,14 @@ int write_file_resource(struct dentry *dentry, void *wim_p) in = w->fp; in_wim_ctype = out_wim_ctype; } - input_res_entry = <e->resource_entry; - input_res_ctype = resource_compression_type( + int input_res_ctype = resource_compression_type( in_wim_ctype, - input_res_entry->flags); + lte->resource_entry.flags); ret = transfer_file_resource(in, - input_res_entry->size, - input_res_entry->original_size, - input_res_entry->offset, + lte->resource_entry.size, + lte->resource_entry.original_size, + lte->resource_entry.offset, input_res_ctype, out, out_wim_ctype,