- /* File that can be hardlinked--- search the table for an
- * existing inode matching the inode number and device;
- * otherwise create a new inode. */
- ret = new_dentry(name, &dentry);
- if (ret)
- return ret;
- inode = inode_table_get_inode(table, ino, devno);
- if (!inode) {
- free_dentry(dentry);
- return WIMLIB_ERR_NOMEM;
+ /* Hard link detection */
+ list = &table->array[hash_inode(table, ino, devno)];
+ hlist_for_each_entry(inode, list, i_hlist_node) {
+ if (inode->i_ino != ino || inode->i_devno != devno)
+ continue;
+ if (inode->i_attributes & FILE_ATTRIBUTE_DIRECTORY) {
+ WARNING("Not honoring directory hard link "
+ "of \"%"TS"\"",
+ inode_any_full_path(inode));
+ continue;
+ }
+ /* Inode found; use it. */
+ return new_dentry_with_existing_inode(name, inode,
+ dentry_ret);