From: Eric Biggers Date: Thu, 22 May 2014 01:53:13 +0000 (-0500) Subject: Fix extract progress when hard links not supported X-Git-Tag: v1.7.0~128 X-Git-Url: https://wimlib.net/git/?p=wimlib;a=commitdiff_plain;h=f4ad72b450ab930005dfac86117733597ba4a2b2 Fix extract progress when hard links not supported --- diff --git a/src/extract.c b/src/extract.c index efbae3d5..7b28dac7 100644 --- a/src/extract.c +++ b/src/extract.c @@ -284,9 +284,24 @@ consume_chunk_with_progress(const void *chunk, size_t size, void *_ctx) struct apply_ctx *ctx = _ctx; wimlib_progress_func_t progress_func = ctx->progress_func; union wimlib_progress_info *progress = &ctx->progress; - u32 num_copies = ctx->cur_stream->out_refcnt; - progress->extract.completed_bytes += size * num_copies; + if (likely(ctx->supported_features.hard_links)) { + progress->extract.completed_bytes += + (u64)size * ctx->cur_stream->out_refcnt; + } else { + const struct stream_owner *owners = stream_owners(ctx->cur_stream); + for (u32 i = 0; i < ctx->cur_stream->out_refcnt; i++) { + const struct wim_inode *inode = owners[i].inode; + const struct wim_dentry *dentry; + + list_for_each_entry(dentry, + &inode->i_extraction_aliases, + d_extraction_alias_node) + { + progress->extract.completed_bytes += size; + } + } + } if (progress->extract.completed_bytes >= ctx->next_progress) { progress_func(WIMLIB_PROGRESS_MSG_EXTRACT_STREAMS, progress); if (progress->extract.completed_bytes >=