From f84a3d108722a2290f45d384638206663a9df824 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Sat, 7 Nov 2015 12:27:22 -0600 Subject: [PATCH] wimappend: fix setting of chunk size when using --wimboot flag --- programs/imagex.c | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/programs/imagex.c b/programs/imagex.c index feb36304..b7ff47ef 100644 --- a/programs/imagex.c +++ b/programs/imagex.c @@ -2122,11 +2122,21 @@ imagex_capture_or_append(int argc, tchar **argv, int cmd) ret = wimlib_set_output_chunk_size(wim, chunk_size); if (ret) goto out_free_wim; - } else if ((add_flags & WIMLIB_ADD_FLAG_WIMBOOT) && - compression_type == WIMLIB_COMPRESSION_TYPE_XPRESS) { - ret = wimlib_set_output_chunk_size(wim, 4096); - if (ret) - goto out_free_wim; + } else if ((add_flags & WIMLIB_ADD_FLAG_WIMBOOT)) { + + int ctype = compression_type; + + if (cmd == CMD_APPEND) { + struct wimlib_wim_info info; + wimlib_get_wim_info(wim, &info); + ctype = info.compression_type; + } + + if (ctype == WIMLIB_COMPRESSION_TYPE_XPRESS) { + ret = wimlib_set_output_chunk_size(wim, 4096); + if (ret) + goto out_free_wim; + } } if (solid_ctype != WIMLIB_COMPRESSION_TYPE_INVALID) { ret = wimlib_set_output_pack_compression_type(wim, solid_ctype); -- 2.43.0