- } else if (!(hlink_list = realloc_array(hlink_list,
- struct file_struct *, hlink_count)))
- out_of_memory("init_hard_links");
-#endif
-}
-
-/* check if a file should be skipped because it is the same as an
- earlier hard link */
-int check_hard_link(struct file_struct *file)
-{
-#if SUPPORT_HARD_LINKS
- int low = 0, high = hlink_count - 1;
- int ret = 0;
-
- if (!hlink_list || !file->link_u.idev)
- return 0;
-
- while (low != high) {
- int mid = (low + high) / 2;
- ret = hlink_compare(&hlink_list[mid], &file);
- if (ret == 0) {
- low = mid;
- break;
- }
- if (ret > 0)
- high = mid;
- else
- low = mid + 1;
- }
-
- /* Check if we ended up finding the file struct or not. */
- if (hlink_compare(&hlink_list[low], &file) != 0)
- return 0;
-
- /* Now check if the previous item shares the current one's device
- * and inode. If so, we're not the "master", so return 1. */
- if (low > 0 &&
- file->F_DEV == hlink_list[low - 1]->F_DEV &&
- file->F_INODE == hlink_list[low - 1]->F_INODE) {
- if (verbose >= 2) {
- rprintf(FINFO, "check_hard_link: \"%s\" is a hard link to file %d, \"%s\"\n",
- f_name(file), low-1, f_name(hlink_list[low-1]));
- }
- return 1;
- }