]> wimlib.net Git - wimlib/commitdiff
wimappend: with --create, ignore --update-of nonexistent target file
authorEric Biggers <ebiggers3@gmail.com>
Tue, 11 Sep 2018 02:58:10 +0000 (19:58 -0700)
committerEric Biggers <ebiggers3@gmail.com>
Tue, 11 Sep 2018 02:58:21 +0000 (19:58 -0700)
programs/imagex.c

index a274f78baed642ff687b73f6937b1be11c315669..a372c14e2e31556c9ed710574cebf240f9dac913 100644 (file)
@@ -2102,8 +2102,20 @@ imagex_capture_or_append(int argc, tchar **argv, int cmd)
        } else {
                struct stat stbuf;
 
        } 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;
                        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) {
        }
 
        if ((write_flags & WIMLIB_WRITE_FLAG_UNSAFE_COMPACT) && !appending) {