]> wimlib.net Git - wimlib/blobdiff - src/inode_fixup.c
Clean up inode alias tracking
[wimlib] / src / inode_fixup.c
index 88a6b8e35c5f5fbc97ded879b3a1358ffbc423fb..7624562371ea97b1d3557ff5e25cc5cafd2c5ce0 100644 (file)
@@ -5,20 +5,18 @@
 /*
  * Copyright (C) 2012, 2013, 2014 Eric Biggers
  *
- * This file is part of wimlib, a library for working with WIM files.
+ * This file is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU Lesser General Public License as published by the Free
+ * Software Foundation; either version 3 of the License, or (at your option) any
+ * later version.
  *
- * wimlib is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License as published by the Free
- * Software Foundation; either version 3 of the License, or (at your option)
- * any later version.
- *
- * wimlib is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
- * A PARTICULAR PURPOSE. See the GNU General Public License for more
+ * This file is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
  * details.
  *
- * You should have received a copy of the GNU General Public License
- * along with wimlib; if not, see http://www.gnu.org/licenses/.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this file; if not, see http://www.gnu.org/licenses/.
  */
 
 #ifdef HAVE_CONFIG_H
@@ -29,7 +27,6 @@
 #include "wimlib/error.h"
 #include "wimlib/inode.h"
 #include "wimlib/inode_table.h"
-#include "wimlib/lookup_table.h"
 
 struct inode_fixup_params {
        struct wim_inode_table inode_table;
@@ -85,7 +82,9 @@ inode_table_insert(struct wim_dentry *dentry, void *_params)
                        params->num_inconsistent_inodes++;
                        continue;
                }
-               if (unlikely(d_inode->i_attributes & FILE_ATTRIBUTE_DIRECTORY)) {
+               if (unlikely((d_inode->i_attributes & FILE_ATTRIBUTE_DIRECTORY) ||
+                            (inode->i_attributes & FILE_ATTRIBUTE_DIRECTORY)))
+               {
                        params->num_dir_hard_links++;
                        if (params->num_dir_hard_links <=
                            MAX_DIR_HARD_LINK_WARNINGS)
@@ -103,10 +102,8 @@ inode_table_insert(struct wim_dentry *dentry, void *_params)
                        continue;
                }
                /* Transfer this dentry to the existing inode.  */
-               free_inode(d_inode);
-               dentry->d_inode = inode;
-               inode->i_nlink++;
-               inode_add_dentry(dentry, inode);
+               d_disassociate(dentry);
+               d_associate(dentry, inode);
                return 0;
        }