- int ret = share_dentry_ads(master,
- container_of(head, struct dentry,
- link_group_list));
- if (ret != 0)
- return ret;
- head = head->next;
+ next = head->next;
+ struct dentry *slave;
+ int ret;
+
+ slave = container_of(head, struct dentry, link_group_list);
+ ret = share_dentry_ads(master, slave);
+
+ /* I would it to be an error if two dentries are the same hard
+ * link group but have irreconcilable differences such as
+ * different file permissions, but unfortunately some of M$'s
+ * WIMs contain many instances of this error. This problem is
+ * worked around here by splitting each offending dentry off
+ * into its own hard link group. */
+ if (ret != 0) {
+ struct link_group *single;
+ single = MALLOC(sizeof(struct link_group));
+ if (!single)
+ return WIMLIB_ERR_NOMEM;
+ single->link_group_id = 0;
+ single->next = *bad_links;
+ *bad_links = single;
+ INIT_LIST_HEAD(&slave->link_group_list);
+ single->dentry_list = &slave->link_group_list;
+ slave->link_group_master_status = GROUP_INDEPENDENT;
+ }
+ head = next;