]> wimlib.net Git - wimlib/blobdiff - src/extract_image.c
dentry_find_streams_to_extract(): Handle hard links correctly
[wimlib] / src / extract_image.c
index 396753501084c55974d654482426f81e8d0fcd2b..fd7453aab9d8d6f34d2e98dcf85ab70dfc80774f 100644 (file)
@@ -59,10 +59,6 @@ do_apply_op(struct wim_dentry *dentry, struct apply_args *args,
                         (full_path_nchars - args->wim_source_path_nchars) + 1];
        p = output_path;
 
-       /*print_dentry(dentry, NULL);*/
-       /*ERROR("%"TS" %"TS, args->target, dentry->_full_path);*/
-       /*ERROR("");*/
-
        tmemcpy(p, args->target, args->target_nchars);
        p += args->target_nchars;
 
@@ -191,7 +187,8 @@ dentry_find_streams_to_extract(struct wim_dentry *dentry, void *_ctx)
 
        lte = inode_unnamed_lte_resolved(inode);
        if (lte) {
-               maybe_add_stream_for_extraction(lte, stream_list);
+               if (!inode->i_visited)
+                       maybe_add_stream_for_extraction(lte, stream_list);
                list_add_tail(&dentry->tmp_list, &lte->lte_dentry_list);
                dentry_added = true;
        }
@@ -214,8 +211,10 @@ dentry_find_streams_to_extract(struct wim_dentry *dentry, void *_ctx)
                        if (inode->i_ads_entries[i].stream_name_nbytes != 0) {
                                lte = inode->i_ads_entries[i].lte;
                                if (lte) {
-                                       maybe_add_stream_for_extraction(lte,
-                                                                       stream_list);
+                                       if (!inode->i_visited) {
+                                               maybe_add_stream_for_extraction(lte,
+                                                                               stream_list);
+                                       }
                                        if (!dentry_added) {
                                                list_add_tail(&dentry->tmp_list,
                                                              &lte->lte_dentry_list);
@@ -225,6 +224,7 @@ dentry_find_streams_to_extract(struct wim_dentry *dentry, void *_ctx)
                        }
                }
        }
+       inode->i_visited = 1;
        return 0;
 }
 
@@ -263,6 +263,7 @@ static int
 dentry_reset_needs_extraction(struct wim_dentry *dentry, void *_ignore)
 {
        dentry->needs_extraction = 0;
+       dentry->d_inode->i_visited = 0;
        return 0;
 }