]> wimlib.net Git - wimlib/blobdiff - src/unix_capture.c
read_wim_lookup_table(): Allow multiple "subpacks" per packed run
[wimlib] / src / unix_capture.c
index 9283df513585b8a2ecbd074aeb82d942a0b79390..c0aa195066e5ea3f6acf767821e2ba8e1f4551dd 100644 (file)
@@ -209,7 +209,10 @@ unix_build_dentry_tree_recursive(struct wim_dentry **root_ret,
        struct wim_inode *inode = NULL;
        struct stat stbuf;
 
-       if (exclude_path(path, path_len, params->config, true)) {
+       if (exclude_path(path + params->capture_root_nchars,
+                        path_len - params->capture_root_nchars,
+                        params->config))
+       {
                ret = 0;
                goto out_progress;
        }
@@ -242,7 +245,7 @@ unix_build_dentry_tree_recursive(struct wim_dentry **root_ret,
                goto out;
        }
 
-       ret = inode_table_new_dentry(&params->inode_table,
+       ret = inode_table_new_dentry(params->inode_table,
                                     path_basename_with_len(path, path_len),
                                     stbuf.st_ino, stbuf.st_dev,
                                     S_ISDIR(stbuf.st_mode), &root);
@@ -342,13 +345,6 @@ unix_build_dentry_tree(struct wim_dentry **root_ret,
                        return WIMLIB_ERR_STAT;
                }
 
-               if ((params->add_flags & WIMLIB_ADD_FLAG_ROOT) &&
-                   !S_ISDIR(root_stbuf.st_mode))
-               {
-                       ERROR("Root of capture \"%s\" is not a directory",
-                             root_disk_path);
-                       return WIMLIB_ERR_NOTDIR;
-               }
                params->capture_root_ino = root_stbuf.st_ino;
                params->capture_root_dev = root_stbuf.st_dev;
        }
@@ -364,6 +360,8 @@ unix_build_dentry_tree(struct wim_dentry **root_ret,
                return WIMLIB_ERR_NOMEM;
        memcpy(path_buf, root_disk_path, path_len + 1);
 
+       params->capture_root_nchars = path_len;
+
        ret = unix_build_dentry_tree_recursive(root_ret, path_buf,
                                               path_len, params);
        FREE(path_buf);