]> wimlib.net Git - wimlib/blobdiff - src/add_image.c
Fix capturing non-directories in source list mode
[wimlib] / src / add_image.c
index b50b05b55400c6c01fe6d0dac616118abd73ce4a..2a7f938ec600b81178f2279eaaeaf5c49d66f89d 100644 (file)
@@ -256,11 +256,6 @@ unix_build_dentry_tree_recursive(struct wim_dentry **root_ret,
        struct wim_inode *inode;
 
        if (exclude_path(path, path_len, params->config, true)) {
-               if (params->add_image_flags & WIMLIB_ADD_IMAGE_FLAG_ROOT) {
-                       ERROR("Cannot exclude the root directory from capture");
-                       ret = WIMLIB_ERR_INVALID_CAPTURE_CONFIG;
-                       goto out;
-               }
                if ((params->add_image_flags & WIMLIB_ADD_IMAGE_FLAG_EXCLUDE_VERBOSE)
                    && params->progress_func)
                {
@@ -388,7 +383,9 @@ unix_build_dentry_tree(struct wim_dentry **root_ret,
                        return WIMLIB_ERR_STAT;
                }
 
-               if (!S_ISDIR(root_stbuf.st_mode)) {
+               if ((params->add_image_flags & WIMLIB_ADD_IMAGE_FLAG_ROOT) &&
+                   !S_ISDIR(root_stbuf.st_mode))
+               {
                        ERROR("Root of capture \"%s\" is not a directory",
                              root_disk_path);
                        return WIMLIB_ERR_NOTDIR;