Split code out into separate files and remove some global variables to
[rsync/rsync.git] / hlink.c
diff --git a/hlink.c b/hlink.c
index 4536636..a38a65b 100644 (file)
--- a/hlink.c
+++ b/hlink.c
@@ -97,14 +97,21 @@ int check_hard_link(struct file_struct *file)
                        low = mid + 1;
        }
 
+       /* XXX: To me this looks kind of dodgy -- why do we use [low]
+        * here and [low-1] below? -- mbp */
        if (hlink_compare(&hlink_list[low], file) != 0)
                return 0;
 
        if (low > 0 &&
            S_ISREG(hlink_list[low - 1].mode) &&
            file->dev == hlink_list[low - 1].dev &&
-           file->inode == hlink_list[low - 1].inode)
+           file->inode == hlink_list[low - 1].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;
+       }
 #endif
 
        return 0;
@@ -152,8 +159,13 @@ static void hard_link_one(int i)
 }
 #endif
 
-/* create any hard links in the flist */
-void do_hard_links(struct file_list *flist)
+
+
+/**
+ * Create any hard links in the global hlink_list.  They were put
+ * there by running init_hard_links on the filelist.
+ **/
+void do_hard_links(void)
 {
 #if SUPPORT_HARD_LINKS
        int i;