]> wimlib.net Git - wimlib/blobdiff - src/hardlink.c
check_add_command(): Use WIMLIB_ERR_UNSUPPORTED when appropriate
[wimlib] / src / hardlink.c
index f6752ff4603ef37d8d07f388d383f0b6dd22cffd..53d03ecde00f4f41fef58dece3460526bf580d9d 100644 (file)
@@ -305,8 +305,6 @@ fix_true_inode(struct wim_inode *inode, struct list_head *inode_list)
                                return WIMLIB_ERR_INVALID_DENTRY;
                        }
                        /* Free the unneeded `struct wim_inode'. */
-                       dentry->d_inode->i_hlist.next = NULL;
-                       dentry->d_inode->i_hlist.pprev = NULL;
                        free_inode(dentry->d_inode);
                        dentry->d_inode = ref_inode;
                        ref_inode->i_nlink++;
@@ -465,6 +463,7 @@ fix_inodes(struct wim_inode_table *table, struct list_head *inode_list,
        INIT_LIST_HEAD(inode_list);
        for (u64 i = 0; i < table->capacity; i++) {
                hlist_for_each_entry_safe(inode, cur, tmp, &table->array[i], i_hlist) {
+                       INIT_LIST_HEAD(&inode->i_list);
                        ret = fix_nominal_inode(inode, inode_list, ino_changes_needed);
                        if (ret)
                                return ret;
@@ -546,7 +545,14 @@ inode_table_prepare_inode_list(struct wim_inode_table *table,
        struct hlist_node *cur, *tmp;
        u64 cur_ino = 1;
 
-       INIT_LIST_HEAD(head);
+       list_for_each_entry(inode, head, i_list) {
+               if (inode->i_nlink > 1)
+                       inode->i_ino = cur_ino++;
+               else
+                       inode->i_ino = 0;
+               list_add_tail(&inode->i_list, head);
+       }
+
        for (size_t i = 0; i < table->capacity; i++) {
                hlist_for_each_entry_safe(inode, cur, tmp, &table->array[i], i_hlist)
                {