]> wimlib.net Git - wimlib/blobdiff - src/wim.c
select_wim_image(): Do not try to select image from non-first part of split WIM
[wimlib] / src / wim.c
index 475ec19b9131f9dcd005e88340d9fc9c5da55d81..73f0060e834dc5302574baa98b60ece2dc871986 100644 (file)
--- a/src/wim.c
+++ b/src/wim.c
@@ -176,6 +176,11 @@ select_wim_image(WIMStruct *w, int image)
                return WIMLIB_ERR_INVALID_IMAGE;
        }
 
+       if (w->hdr.part_number != 1) {
+               ERROR("Cannot select an image from a non-first part of a split WIM");
+               return WIMLIB_ERR_SPLIT_UNSUPPORTED;
+       }
+
        /* If a valid image is currently selected, it can be freed if it is not
         * modified.  */
        if (w->current_image != WIMLIB_NO_IMAGE) {
@@ -351,7 +356,7 @@ wimlib_get_wim_info(WIMStruct *wim, struct wimlib_wim_info *info)
                info->total_bytes = 0;
        info->has_integrity_table = wim->hdr.integrity.offset != 0;
        info->opened_from_file = (wim->filename != NULL);
-       info->is_readonly == (wim->hdr.flags & WIM_HDR_FLAG_READONLY) ||
+       info->is_readonly = (wim->hdr.flags & WIM_HDR_FLAG_READONLY) ||
                             (wim->hdr.total_parts != 1) ||
                             (wim->filename && taccess(wim->filename, W_OK));
        info->has_rpfix = (wim->hdr.flags & WIM_HDR_FLAG_RP_FIX) != 0;