]> wimlib.net Git - wimlib/blobdiff - src/add_image.c
xml_update_image_info(): Assume streams are resolved
[wimlib] / src / add_image.c
index 904f35452b9023866f4ea73cd257c607f3073601..c4c1033bb2de3b691313bf5c8e1f4955b623a110 100644 (file)
@@ -59,8 +59,8 @@ add_new_dentry_tree(WIMStruct *w, struct wim_dentry *root_dentry,
                    struct wim_security_data *sd)
 {
        struct wim_image_metadata *new_imd;
-       int ret;
        struct wim_lookup_table_entry *metadata_lte;
+       int ret;
 
        metadata_lte = new_lookup_table_entry();
        if (!metadata_lte)
@@ -113,7 +113,8 @@ unix_capture_regular_file(const char *path,
                lte->file_on_disk = file_on_disk;
                lte->resource_location = RESOURCE_IN_FILE_ON_DISK;
                lte->resource_entry.original_size = size;
-               lookup_table_insert_unhashed(lookup_table, lte, &inode->i_lte);
+               lookup_table_insert_unhashed(lookup_table, lte, inode, 0);
+               inode->i_lte = lte;
        }
        return 0;
 }
@@ -836,6 +837,9 @@ wimlib_add_image_multisource(WIMStruct *w,
        struct list_head unhashed_streams;
        int ret;
        struct sd_set sd_set;
+#ifdef WITH_NTFS_3G
+       struct _ntfs_volume *ntfs_vol = NULL;
+#endif
 
        if (add_image_flags & WIMLIB_ADD_IMAGE_FLAG_NTFS) {
 #ifdef WITH_NTFS_3G
@@ -849,7 +853,7 @@ wimlib_add_image_multisource(WIMStruct *w,
                        return WIMLIB_ERR_INVALID_PARAM;
                }
                capture_tree = build_dentry_tree_ntfs;
-               extra_arg = &w->ntfs_vol;
+               extra_arg = &ntfs_vol;
 #else
                ERROR("wimlib was compiled without support for NTFS-3g, so\n"
                      "        cannot capture a WIM image directly from a NTFS volume!");
@@ -990,13 +994,23 @@ wimlib_add_image_multisource(WIMStruct *w,
        }
 
        ret = add_new_dentry_tree(w, root_dentry, sd);
-       if (ret)
+
+       if (ret) {
+#ifdef WITH_NTFS_3G
+               if (ntfs_vol)
+                       do_ntfs_umount(ntfs_vol);
+#endif
                goto out_free_dentry_tree;
+       }
 
        imd = w->image_metadata[w->hdr.image_count - 1];
        INIT_LIST_HEAD(&imd->unhashed_streams);
        list_splice(&unhashed_streams, &imd->unhashed_streams);
 
+#ifdef WITH_NTFS_3G
+       imd->ntfs_vol = ntfs_vol;
+#endif
+
        DEBUG("Assigning hard link group IDs");
        inode_table_prepare_inode_list(&inode_table, &imd->inode_list);