From e7e2c4d677c3c40b45160ace50159ee18fcb4986 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Mon, 10 Sep 2018 19:58:10 -0700 Subject: [PATCH] wimappend: with --create, ignore --update-of nonexistent target file --- programs/imagex.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/programs/imagex.c b/programs/imagex.c index a274f78b..a372c14e 100644 --- a/programs/imagex.c +++ b/programs/imagex.c @@ -2102,8 +2102,20 @@ imagex_capture_or_append(int argc, tchar **argv, int cmd) } else { struct stat stbuf; - if (create && tstat(wimfile, &stbuf) != 0 && errno == ENOENT) + /* Check for 'wimappend --create' acting as wimcapture */ + if (create && tstat(wimfile, &stbuf) != 0 && errno == ENOENT) { + appending = false; + + /* Ignore '--update-of' for the target WIMFILE */ + if (template_image_name_or_num && + (!template_wimfile || + !tstrcmp(template_wimfile, wimfile))) + { + template_image_name_or_num = NULL; + template_wimfile = NULL; + } + } } if ((write_flags & WIMLIB_WRITE_FLAG_UNSAFE_COMPACT) && !appending) { -- 2.43.0