]> wimlib.net Git - wimlib/blobdiff - programs/imagex.c
wimlib-imagex: Don't open base or template WIMs for write access
[wimlib] / programs / imagex.c
index 820c4338db53b43970fcc011f8edd49011a62808..eec90698e7477d8b6ae81a6031a5b32e0f355317 100644 (file)
@@ -2091,8 +2091,8 @@ imagex_capture_or_append(int argc, tchar **argv, int cmd)
                for (size_t i = 0; i < base_wimfiles.num_strings; i++) {
                        ret = wimlib_open_wim_with_progress(
                                    base_wimfiles.strings[i],
-                                   open_flags, &base_wims[i],
-                                   imagex_progress_func, NULL);
+                                   open_flags & ~WIMLIB_OPEN_FLAG_WRITE_ACCESS,
+                                   &base_wims[i], imagex_progress_func, NULL);
                        if (ret)
                                goto out_free_base_wims;
 
@@ -2127,7 +2127,7 @@ imagex_capture_or_append(int argc, tchar **argv, int cmd)
                        template_wim = wim;
                } else {
                        ret = wimlib_open_wim_with_progress(template_wimfile,
-                                                           open_flags,
+                                                           open_flags & ~WIMLIB_OPEN_FLAG_WRITE_ACCESS,
                                                            &template_wim,
                                                            imagex_progress_func,
                                                            NULL);