+#endif
+ }
+#ifdef SUPPORT_ACLS
+ else if (preserve_acls)
+ free_acl(&alt_sx);
+#endif
+ }
+
+ if (maybe_hard_link(file, ndx, fname, statret, sxp, prev_name, &prev_st,
+ realname, itemizing, code) < 0)
+ return -1;
+
+ if (remove_source_files == 1 && do_xfers)
+ send_msg_int(MSG_SUCCESS, ndx);
+
+ return 1;
+}
+
+int hard_link_one(struct file_struct *file, const char *fname,
+ const char *oldname, int terse)
+{
+ if (do_link(oldname, fname) < 0) {
+ enum logcode code;
+ if (terse) {
+ if (!verbose)
+ return -1;
+ code = FINFO;
+ } else
+ code = FERROR;
+ rsyserr(code, errno, "link %s => %s failed",
+ full_fname(fname), oldname);
+ return 0;
+ }
+
+ file->flags |= FLAG_HLINK_DONE;
+
+ return 1;
+}
+
+void finish_hard_link(struct file_struct *file, const char *fname, int fin_ndx,
+ STRUCT_STAT *stp, int itemizing, enum logcode code,
+ int alt_dest)
+{
+ stat_x prev_sx;
+ STRUCT_STAT st;
+ char alt_name[MAXPATHLEN], *prev_name;
+ const char *our_name;
+ struct file_list *flist;
+ int prev_statret, ndx, prev_ndx = F_HL_PREV(file);
+
+ if (stp == NULL && prev_ndx >= 0) {
+ if (link_stat(fname, &st, 0) < 0) {
+ rsyserr(FERROR, errno, "stat %s failed",
+ full_fname(fname));
+ return;