robust_unlink(fname); /* Just in case... */
--- old/compat.c
+++ new/compat.c
-@@ -55,6 +55,8 @@ void setup_protocol(int f_out,int f_in)
+@@ -40,6 +40,7 @@ extern int prune_empty_dirs;
+ extern int protocol_version;
+ extern int preserve_uid;
+ extern int preserve_gid;
++extern int preserve_acls;
+ extern int preserve_hard_links;
+ extern int need_messages_from_generator;
+ extern int delete_mode, delete_before, delete_during, delete_after;
+@@ -60,6 +61,8 @@ void setup_protocol(int f_out,int f_in)
preserve_uid = ++file_extra_cnt;
if (preserve_gid)
preserve_gid = ++file_extra_cnt;
extern char *backup_dir;
extern char *backup_suffix;
extern int backup_suffix_len;
-@@ -511,22 +513,27 @@ static void do_delete_pass(struct file_l
+@@ -511,22 +513,31 @@ static void do_delete_pass(struct file_l
rprintf(FINFO, " \r");
}
-int unchanged_attrs(struct file_struct *file, STRUCT_STAT *st)
-+int unchanged_attrs(struct file_struct *file, statx *sxp)
++int unchanged_attrs(const char *fname, struct file_struct *file, statx *sxp)
{
- if (preserve_perms && !BITS_EQUAL(st->st_mode, file->mode, CHMOD_BITS))
+ if (preserve_perms && !BITS_EQUAL(sxp->st.st_mode, file->mode, CHMOD_BITS))
return 0;
+#ifdef SUPPORT_ACLS
-+ if (preserve_acls && set_acl(NULL, file, sxp) == 0)
-+ return 0;
++ if (preserve_acls) {
++ if (!ACL_READY(*sxp))
++ get_acl(fname, sxp);
++ if (set_acl(NULL, file, sxp) == 0)
++ return 0;
++ }
+#endif
+
return 1;
}
- void itemize(struct file_struct *file, int ndx, int statret,
+-void itemize(struct file_struct *file, int ndx, int statret,
- STRUCT_STAT *st, int32 iflags, uchar fnamecmp_type,
++void itemize(const char *fname, struct file_struct *file, int ndx, int statret,
+ statx *sxp, int32 iflags, uchar fnamecmp_type,
const char *xname)
{
if (statret >= 0) { /* A from-dest-dir statret can == 1! */
-@@ -534,20 +541,24 @@ void itemize(struct file_struct *file, i
+@@ -534,20 +545,28 @@ void itemize(struct file_struct *file, i
: S_ISDIR(file->mode) ? !omit_dir_times
: !S_ISLNK(file->mode);
+ && sxp->st.st_gid != F_GID(file))
iflags |= ITEM_REPORT_GROUP;
+#ifdef SUPPORT_ACLS
-+ if (preserve_acls && set_acl(NULL, file, sxp) == 0)
-+ iflags |= ITEM_REPORT_ACL;
++ if (preserve_acls) {
++ if (!ACL_READY(*sxp))
++ get_acl(fname, sxp);
++ if (set_acl(NULL, file, sxp) == 0)
++ iflags |= ITEM_REPORT_ACL;
++ }
+#endif
} else
iflags |= ITEM_IS_NEW;
-@@ -783,7 +794,7 @@ static int find_fuzzy(struct file_struct
+@@ -783,7 +802,7 @@ static int find_fuzzy(struct file_struct
* handling the file, -1 if no dest-linking occurred, or a non-negative
* value if we found an alternate basis file. */
static int try_dests_reg(struct file_struct *file, char *fname, int ndx,
enum logcode code)
{
int best_match = -1;
-@@ -792,7 +803,7 @@ static int try_dests_reg(struct file_str
+@@ -792,7 +811,7 @@ static int try_dests_reg(struct file_str
do {
pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname);
continue;
switch (match_level) {
case 0:
-@@ -800,16 +811,20 @@ static int try_dests_reg(struct file_str
+@@ -800,16 +819,16 @@ static int try_dests_reg(struct file_str
match_level = 1;
/* FALL THROUGH */
case 1:
/* FALL THROUGH */
case 2:
- if (!unchanged_attrs(file, stp))
-+#ifdef SUPPORT_ACLS
-+ if (preserve_acls)
-+ get_acl(cmpbuf, sxp);
-+#endif
-+ if (!unchanged_attrs(file, sxp))
++ if (!unchanged_attrs(cmpbuf, file, sxp))
continue;
if (always_checksum > 0 && preserve_times
- && cmp_time(stp->st_mtime, file->modtime))
continue;
best_match = j;
match_level = 3;
-@@ -824,7 +839,7 @@ static int try_dests_reg(struct file_str
+@@ -824,7 +843,7 @@ static int try_dests_reg(struct file_str
if (j != best_match) {
j = best_match;
pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname);
return -1;
}
-@@ -834,16 +849,25 @@ static int try_dests_reg(struct file_str
+@@ -834,16 +853,16 @@ static int try_dests_reg(struct file_str
if (!hard_link_one(file, fname, cmpbuf, 1))
goto try_a_copy;
if (preserve_hard_links && F_IS_HLINKED(file))
+ finish_hard_link(file, fname, &sxp->st, itemizing, code, j);
if (itemizing && (verbose > 1 || stdout_format_has_i > 1)) {
- itemize(file, ndx, 1, stp,
-+#ifdef SUPPORT_ACLS
-+ if (preserve_acls && !ACL_READY(*sxp))
-+ get_acl(fname, sxp);
-+#endif
-+ itemize(file, ndx, 1, sxp,
++ itemize(fname, file, ndx, 1, sxp,
ITEM_LOCAL_CHANGE | ITEM_XNAME_FOLLOWS,
0, "");
}
} else
#endif
-- if (itemizing)
+ if (itemizing)
- itemize(file, ndx, 0, stp, 0, 0, NULL);
-+ if (itemizing) {
-+#ifdef SUPPORT_ACLS
-+ if (preserve_acls && !ACL_READY(*sxp))
-+ get_acl(fname, sxp);
-+#endif
-+ itemize(file, ndx, 0, sxp, 0, 0, NULL);
-+ }
++ itemize(fname, file, ndx, 0, sxp, 0, 0, NULL);
if (verbose > 1 && maybe_ATTRS_REPORT)
rprintf(FCLIENT, "%s is uptodate\n", fname);
return -2;
-@@ -860,8 +884,13 @@ static int try_dests_reg(struct file_str
- }
+@@ -861,7 +880,7 @@ static int try_dests_reg(struct file_str
return -1;
}
-- if (itemizing)
+ if (itemizing)
- itemize(file, ndx, 0, stp, ITEM_LOCAL_CHANGE, 0, NULL);
-+ if (itemizing) {
-+#ifdef SUPPORT_ACLS
-+ if (preserve_acls && !ACL_READY(*sxp))
-+ get_acl(fname, sxp);
-+#endif
-+ itemize(file, ndx, 0, sxp, ITEM_LOCAL_CHANGE, 0, NULL);
-+ }
++ itemize(fname, file, ndx, 0, sxp, ITEM_LOCAL_CHANGE, 0, NULL);
set_file_attrs(fname, file, NULL, 0);
if (maybe_ATTRS_REPORT
&& ((!itemizing && verbose && match_level == 2)
-@@ -872,7 +901,7 @@ static int try_dests_reg(struct file_str
+@@ -872,7 +891,7 @@ static int try_dests_reg(struct file_str
}
#ifdef SUPPORT_HARD_LINKS
if (preserve_hard_links && F_IS_HLINKED(file))
#endif
return -2;
}
-@@ -884,7 +913,7 @@ static int try_dests_reg(struct file_str
+@@ -884,7 +903,7 @@ static int try_dests_reg(struct file_str
* handling the file, or -1 if no dest-linking occurred, or a non-negative
* value if we found an alternate basis file. */
static int try_dests_non(struct file_struct *file, char *fname, int ndx,
enum logcode code)
{
char lnk[MAXPATHLEN];
-@@ -917,24 +946,24 @@ static int try_dests_non(struct file_str
+@@ -917,24 +936,24 @@ static int try_dests_non(struct file_str
do {
pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname);
continue;
break;
#endif
-@@ -949,7 +978,7 @@ static int try_dests_non(struct file_str
+@@ -949,7 +968,7 @@ static int try_dests_non(struct file_str
case TYPE_SPECIAL:
case TYPE_DEVICE:
devp = F_RDEV_P(file);
continue;
break;
#ifdef SUPPORT_LINKS
-@@ -966,7 +995,11 @@ static int try_dests_non(struct file_str
+@@ -966,7 +985,7 @@ static int try_dests_non(struct file_str
match_level = 2;
best_match = j;
}
- if (unchanged_attrs(file, stp)) {
-+#ifdef SUPPORT_ACLS
-+ if (preserve_acls)
-+ get_acl(cmpbuf, sxp);
-+#endif
-+ if (unchanged_attrs(file, sxp)) {
++ if (unchanged_attrs(cmpbuf, file, sxp)) {
match_level = 3;
best_match = j;
break;
-@@ -979,7 +1012,7 @@ static int try_dests_non(struct file_str
+@@ -979,7 +998,7 @@ static int try_dests_non(struct file_str
if (j != best_match) {
j = best_match;
pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname);
return -1;
}
-@@ -1010,7 +1043,15 @@ static int try_dests_non(struct file_str
+@@ -1010,7 +1029,7 @@ static int try_dests_non(struct file_str
: ITEM_LOCAL_CHANGE
+ (match_level == 3 ? ITEM_XNAME_FOLLOWS : 0);
char *lp = match_level == 3 ? "" : NULL;
- itemize(file, ndx, 0, stp, chg + ITEM_MATCHED, 0, lp);
-+#ifdef SUPPORT_ACLS
-+ if (preserve_acls)
-+ get_acl(fname, sxp);
-+#endif
-+ itemize(file, ndx, 0, sxp, chg + ITEM_MATCHED, 0, lp);
-+#ifdef SUPPORT_ACLS
-+ if (preserve_acls)
-+ free_acl(sxp);
-+#endif
++ itemize(fname, file, ndx, 0, sxp, chg + ITEM_MATCHED, 0, lp);
}
if (verbose > 1 && maybe_ATTRS_REPORT) {
rprintf(FCLIENT, "%s%s is uptodate\n",
-@@ -1023,6 +1064,7 @@ static int try_dests_non(struct file_str
+@@ -1023,6 +1042,7 @@ static int try_dests_non(struct file_str
}
static int phase = 0;
/* Acts on the indicated item in cur_flist whose name is fname. If a dir,
* make sure it exists, and has the right permissions/timestamp info. For
-@@ -1043,7 +1085,8 @@ static void recv_generator(char *fname,
+@@ -1043,7 +1063,8 @@ static void recv_generator(char *fname,
static int need_fuzzy_dirlist = 0;
struct file_struct *fuzzy_file = NULL;
int fd = -1, f_copy = -1;
struct file_struct *back_file = NULL;
int statret, real_ret, stat_errno;
char *fnamecmp, *partialptr, *backupptr = NULL;
-@@ -1088,6 +1131,9 @@ static void recv_generator(char *fname,
+@@ -1088,6 +1109,9 @@ static void recv_generator(char *fname,
return;
}
}
if (dry_run > 1) {
if (fuzzy_dirlist) {
flist_free(fuzzy_dirlist);
-@@ -1100,7 +1146,7 @@ static void recv_generator(char *fname,
+@@ -1100,7 +1124,7 @@ static void recv_generator(char *fname,
const char *dn = file->dirname ? file->dirname : ".";
if (parent_dirname != dn && strcmp(parent_dirname, dn) != 0) {
if (relative_paths && !implied_dirs
&& create_directory_path(fname) < 0) {
rsyserr(FERROR, errno,
"recv_generator: mkdir %s failed",
-@@ -1112,6 +1158,10 @@ static void recv_generator(char *fname,
+@@ -1112,6 +1136,10 @@ static void recv_generator(char *fname,
}
if (fuzzy_basis)
need_fuzzy_dirlist = 1;
}
parent_dirname = dn;
-@@ -1121,7 +1171,7 @@ static void recv_generator(char *fname,
+@@ -1121,7 +1149,7 @@ static void recv_generator(char *fname,
need_fuzzy_dirlist = 0;
}
keep_dirlinks && S_ISDIR(file->mode));
stat_errno = errno;
}
-@@ -1149,8 +1199,8 @@ static void recv_generator(char *fname,
+@@ -1149,8 +1177,8 @@ static void recv_generator(char *fname,
* file of that name and it is *not* a directory, then
* we need to delete it. If it doesn't exist, then
* (perhaps recursively) create it. */
return;
statret = -1;
}
-@@ -1159,18 +1209,18 @@ static void recv_generator(char *fname,
+@@ -1159,18 +1187,18 @@ static void recv_generator(char *fname,
dry_run++;
}
real_ret = statret;
itemizing, code);
if (j == -2) {
itemizing = 0;
-@@ -1179,7 +1229,11 @@ static void recv_generator(char *fname,
+@@ -1179,7 +1207,7 @@ static void recv_generator(char *fname,
statret = 1;
}
if (itemizing && f_out != -1) {
- itemize(file, ndx, statret, &st,
-+#ifdef SUPPORT_ACLS
-+ if (preserve_acls && statret == 0)
-+ get_acl(fname, &sx);
-+#endif
-+ itemize(file, ndx, statret, &sx,
++ itemize(fname, file, ndx, statret, &sx,
statret ? ITEM_LOCAL_CHANGE : 0, 0, NULL);
}
if (real_ret != 0 && do_mkdir(fname,file->mode) < 0 && errno != EEXIST) {
-@@ -1193,38 +1247,39 @@ static void recv_generator(char *fname,
+@@ -1193,38 +1221,39 @@ static void recv_generator(char *fname,
"*** Skipping any contents from this failed directory ***\n");
missing_below = F_DEPTH(file);
file->flags |= FLAG_MISSING_DIR;
#endif
if (preserve_links && S_ISLNK(file->mode)) {
-@@ -1244,28 +1299,28 @@ static void recv_generator(char *fname,
+@@ -1244,28 +1273,28 @@ static void recv_generator(char *fname,
char lnk[MAXPATHLEN];
int len;
if (itemizing)
- itemize(file, ndx, 0, &st, 0, 0, NULL);
- set_file_attrs(fname, file, &st, maybe_ATTRS_REPORT);
-+ itemize(file, ndx, 0, &sx, 0, 0, NULL);
++ itemize(fname, file, ndx, 0, &sx, 0, 0, NULL);
+ set_file_attrs(fname, file, &sx, maybe_ATTRS_REPORT);
#ifdef SUPPORT_HARD_LINKS
if (preserve_hard_links && F_IS_HLINKED(file))
itemizing, code);
if (j == -2) {
#ifndef CAN_HARDLINK_SYMLINK
-@@ -1274,7 +1329,7 @@ static void recv_generator(char *fname,
+@@ -1274,7 +1303,7 @@ static void recv_generator(char *fname,
} else
#endif
if (!copy_dest)
itemizing = 0;
code = FNONE;
} else if (j >= 0)
-@@ -1282,7 +1337,7 @@ static void recv_generator(char *fname,
+@@ -1282,7 +1311,7 @@ static void recv_generator(char *fname,
}
#ifdef SUPPORT_HARD_LINKS
if (preserve_hard_links && F_HLINK_NOT_LAST(file))
#endif
if (do_symlink(sl, fname) != 0) {
rsyserr(FERROR, errno, "symlink %s -> \"%s\" failed",
-@@ -1290,7 +1345,7 @@ static void recv_generator(char *fname,
+@@ -1290,7 +1319,7 @@ static void recv_generator(char *fname,
} else {
set_file_attrs(fname, file, NULL, 0);
if (itemizing) {
- itemize(file, ndx, statret, &st,
-+ itemize(file, ndx, statret, &sx,
++ itemize(fname, file, ndx, statret, &sx,
ITEM_LOCAL_CHANGE, 0, NULL);
}
if (code != FNONE && verbose)
-@@ -1306,7 +1361,7 @@ static void recv_generator(char *fname,
+@@ -1306,7 +1335,7 @@ static void recv_generator(char *fname,
goto return_with_success;
}
#endif
}
if ((am_root && preserve_devices && IS_DEVICE(file->mode))
-@@ -1316,33 +1371,38 @@ static void recv_generator(char *fname,
+@@ -1316,33 +1345,33 @@ static void recv_generator(char *fname,
if (statret == 0) {
char *t;
if (IS_DEVICE(file->mode)) {
+ && BITS_EQUAL(sx.st.st_mode, file->mode, _S_IFMT)
+ && sx.st.st_rdev == rdev) {
/* The device or special file is identical. */
-- if (itemizing)
+ if (itemizing)
- itemize(file, ndx, 0, &st, 0, 0, NULL);
- set_file_attrs(fname, file, &st, maybe_ATTRS_REPORT);
-+ if (itemizing) {
-+#ifdef SUPPORT_ACLS
-+ if (preserve_acls)
-+ get_acl(fname, &sx);
-+#endif
-+ itemize(file, ndx, 0, &sx, 0, 0, NULL);
-+ }
++ itemize(fname, file, ndx, 0, &sx, 0, 0, NULL);
+ set_file_attrs(fname, file, &sx, maybe_ATTRS_REPORT);
#ifdef SUPPORT_HARD_LINKS
if (preserve_hard_links && F_IS_HLINKED(file))
itemizing, code);
if (j == -2) {
#ifndef CAN_HARDLINK_SPECIAL
-@@ -1351,7 +1411,7 @@ static void recv_generator(char *fname,
+@@ -1351,7 +1380,7 @@ static void recv_generator(char *fname,
} else
#endif
if (!copy_dest)
itemizing = 0;
code = FNONE;
} else if (j >= 0)
-@@ -1359,7 +1419,7 @@ static void recv_generator(char *fname,
+@@ -1359,7 +1388,7 @@ static void recv_generator(char *fname,
}
#ifdef SUPPORT_HARD_LINKS
if (preserve_hard_links && F_HLINK_NOT_LAST(file))
#endif
if (verbose > 2) {
rprintf(FINFO, "mknod(%s, 0%o, [%ld,%ld])\n",
-@@ -1372,7 +1432,11 @@ static void recv_generator(char *fname,
+@@ -1372,7 +1401,7 @@ static void recv_generator(char *fname,
} else {
set_file_attrs(fname, file, NULL, 0);
if (itemizing) {
- itemize(file, ndx, statret, &st,
-+#ifdef SUPPORT_ACLS
-+ if (preserve_acls && statret == 0)
-+ get_acl(fname, &sx);
-+#endif
-+ itemize(file, ndx, statret, &sx,
++ itemize(fname, file, ndx, statret, &sx,
ITEM_LOCAL_CHANGE, 0, NULL);
}
if (code != FNONE && verbose)
-@@ -1384,14 +1448,14 @@ static void recv_generator(char *fname,
+@@ -1384,14 +1413,14 @@ static void recv_generator(char *fname,
if (remove_source_files == 1)
goto return_with_success;
}
}
if (max_size > 0 && F_LENGTH(file) > max_size) {
-@@ -1400,7 +1464,7 @@ static void recv_generator(char *fname,
+@@ -1400,7 +1429,7 @@ static void recv_generator(char *fname,
fname = f_name(file, NULL);
rprintf(FINFO, "%s is over max-size\n", fname);
}
}
if (min_size > 0 && F_LENGTH(file) < min_size) {
if (verbose > 1) {
-@@ -1408,39 +1472,39 @@ static void recv_generator(char *fname,
+@@ -1408,39 +1437,39 @@ static void recv_generator(char *fname,
fname = f_name(file, NULL);
rprintf(FINFO, "%s is under min-size\n", fname);
}
}
if (j >= 0) {
fnamecmp = fnamecmpbuf;
-@@ -1450,7 +1514,7 @@ static void recv_generator(char *fname,
+@@ -1450,7 +1479,7 @@ static void recv_generator(char *fname,
}
real_ret = statret;
if (partial_dir && (partialptr = partial_dir_fname(fname)) != NULL
&& link_stat(partialptr, &partial_st, 0) == 0
-@@ -1469,7 +1533,7 @@ static void recv_generator(char *fname,
+@@ -1469,7 +1498,7 @@ static void recv_generator(char *fname,
rprintf(FINFO, "fuzzy basis selected for %s: %s\n",
fname, fnamecmpbuf);
}
statret = 0;
fnamecmp = fnamecmpbuf;
fnamecmp_type = FNAMECMP_FUZZY;
-@@ -1479,45 +1543,50 @@ static void recv_generator(char *fname,
+@@ -1479,45 +1508,45 @@ static void recv_generator(char *fname,
if (statret != 0) {
#ifdef SUPPORT_HARD_LINKS
if (preserve_hard_links && F_HLINK_NOT_LAST(file))
do_unlink(partialptr);
handle_partial_dir(partialptr, PDIR_DELETE);
}
-- if (itemizing)
+ if (itemizing)
- itemize(file, ndx, statret, &st, 0, 0, NULL);
- set_file_attrs(fname, file, &st, maybe_ATTRS_REPORT);
-+ if (itemizing) {
-+#ifdef SUPPORT_ACLS
-+ if (preserve_acls && statret == 0)
-+ get_acl(fnamecmp, &sx);
-+#endif
-+ itemize(file, ndx, statret, &sx, 0, 0, NULL);
-+ }
++ itemize(fnamecmp, file, ndx, statret, &sx, 0, 0, NULL);
+ set_file_attrs(fname, file, &sx, maybe_ATTRS_REPORT);
#ifdef SUPPORT_HARD_LINKS
if (preserve_hard_links && F_IS_HLINKED(file))
fnamecmp = partialptr;
fnamecmp_type = FNAMECMP_PARTIAL_DIR;
statret = 0;
-@@ -1542,16 +1611,20 @@ static void recv_generator(char *fname,
+@@ -1542,7 +1571,7 @@ static void recv_generator(char *fname,
/* pretend the file didn't exist */
#ifdef SUPPORT_HARD_LINKS
if (preserve_hard_links && F_HLINK_NOT_LAST(file))
+ goto cleanup;
#endif
statret = real_ret = -1;
-+#ifdef SUPPORT_ACLS
-+ if (preserve_acls && ACL_READY(sx))
-+ free_acl(&sx);
-+#endif
goto notify_others;
- }
-
+@@ -1551,7 +1580,7 @@ static void recv_generator(char *fname,
if (inplace && make_backups > 0 && fnamecmp_type == FNAMECMP_FNAME) {
if (!(backupptr = get_backup_name(fname))) {
close(fd);
}
if (!(back_file = make_file(fname, NULL, NULL, 0, NO_FILTERS))) {
close(fd);
-@@ -1562,7 +1635,7 @@ static void recv_generator(char *fname,
+@@ -1562,7 +1591,7 @@ static void recv_generator(char *fname,
full_fname(backupptr));
unmake_file(back_file);
close(fd);
}
if ((f_copy = do_open(backupptr,
O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0600)) < 0) {
-@@ -1570,14 +1643,14 @@ static void recv_generator(char *fname,
+@@ -1570,14 +1599,14 @@ static void recv_generator(char *fname,
full_fname(backupptr));
unmake_file(back_file);
close(fd);
}
if (verbose > 2)
-@@ -1601,26 +1674,34 @@ static void recv_generator(char *fname,
+@@ -1601,26 +1630,30 @@ static void recv_generator(char *fname,
iflags |= ITEM_BASIS_TYPE_FOLLOWS;
if (fnamecmp_type == FNAMECMP_FUZZY)
iflags |= ITEM_XNAME_FOLLOWS;
- itemize(file, -1, real_ret, &real_st, iflags, fnamecmp_type,
-+#ifdef SUPPORT_ACLS
-+ if (preserve_acls && real_ret == 0)
-+ get_acl(fnamecmp, &real_sx);
-+#endif
-+ itemize(file, -1, real_ret, &real_sx, iflags, fnamecmp_type,
++ itemize(fnamecmp, file, -1, real_ret, &real_sx, iflags, fnamecmp_type,
fuzzy_file ? fuzzy_file->basename : NULL);
+#ifdef SUPPORT_ACLS
+ if (preserve_acls)
if (f_copy >= 0) {
close(f_copy);
-@@ -1633,6 +1714,13 @@ static void recv_generator(char *fname,
+@@ -1633,6 +1666,13 @@ static void recv_generator(char *fname,
}
close(fd);
}
static void touch_up_dirs(struct file_list *flist, int ndx)
-@@ -1803,6 +1891,8 @@ void generate_files(int f_out, const cha
+@@ -1803,6 +1843,8 @@ void generate_files(int f_out, const cha
* notice that and let us know via the redo pipe (or its closing). */
ignore_timeout = 1;
extern int make_backups;
extern int protocol_version;
extern int remove_source_files;
-@@ -267,15 +268,19 @@ void match_hard_links(void)
+@@ -267,15 +268,15 @@ void match_hard_links(void)
}
static int maybe_hard_link(struct file_struct *file, int ndx,
+ && sxp->st.st_ino == old_stp->st_ino) {
if (itemizing) {
- itemize(file, ndx, statret, stp,
-+#ifdef SUPPORT_ACLS
-+ if (preserve_acls && !ACL_READY(*sxp))
-+ get_acl(fname, sxp);
-+#endif
-+ itemize(file, ndx, statret, sxp,
++ itemize(fname, file, ndx, statret, sxp,
ITEM_LOCAL_CHANGE | ITEM_XNAME_FOLLOWS,
0, "");
}
-@@ -296,7 +301,11 @@ static int maybe_hard_link(struct file_s
+@@ -296,7 +297,7 @@ static int maybe_hard_link(struct file_s
if (hard_link_one(file, fname, oldname, 0)) {
if (itemizing) {
- itemize(file, ndx, statret, stp,
-+#ifdef SUPPORT_ACLS
-+ if (preserve_acls && statret == 0 && !ACL_READY(*sxp))
-+ get_acl(fname, sxp);
-+#endif
-+ itemize(file, ndx, statret, sxp,
++ itemize(fname, file, ndx, statret, sxp,
ITEM_LOCAL_CHANGE | ITEM_XNAME_FOLLOWS, 0,
realname);
}
-@@ -310,7 +319,7 @@ static int maybe_hard_link(struct file_s
+@@ -310,7 +311,7 @@ static int maybe_hard_link(struct file_s
/* Only called if FLAG_HLINKED is set and FLAG_HLINK_FIRST is not. Returns:
* 0 = process the file, 1 = skip the file, -1 = error occurred. */
int hard_link_check(struct file_struct *file, int ndx, const char *fname,
enum logcode code)
{
STRUCT_STAT prev_st;
-@@ -361,18 +370,20 @@ int hard_link_check(struct file_struct *
+@@ -361,18 +362,20 @@ int hard_link_check(struct file_struct *
if (statret < 0 && basis_dir[0] != NULL) {
/* If we match an alt-dest item, we don't output this as a change. */
char cmpbuf[MAXPATHLEN];
if (verbose < 2 || !stdout_format_has_i) {
itemizing = 0;
code = FNONE;
-@@ -381,16 +392,36 @@ int hard_link_check(struct file_struct *
+@@ -381,16 +384,32 @@ int hard_link_check(struct file_struct *
}
break;
}
statret = 1;
- *stp = alt_st;
- if (unchanged_attrs(file, &alt_st))
-+#ifdef SUPPORT_ACLS
-+ if (preserve_acls)
-+ get_acl(cmpbuf, &alt_sx);
-+#endif
-+ if (unchanged_attrs(file, &alt_sx))
++ if (unchanged_attrs(cmpbuf, file, &alt_sx))
break;
} while (basis_dir[++j] != NULL);
+ if (statret == 1) {
realname, itemizing, code) < 0)
return -1;
-@@ -425,7 +456,8 @@ void finish_hard_link(struct file_struct
+@@ -425,7 +444,8 @@ void finish_hard_link(struct file_struct
STRUCT_STAT *stp, int itemizing, enum logcode code,
int alt_dest)
{
char alt_name[MAXPATHLEN], *prev_name;
const char *our_name;
int prev_statret, ndx, prev_ndx = F_HL_PREV(file);
-@@ -449,14 +481,24 @@ void finish_hard_link(struct file_struct
+@@ -449,14 +469,24 @@ void finish_hard_link(struct file_struct
} else
our_name = fname;
default:
/* A large opt value means that set_refuse_options()
* turned this option off. */
-@@ -1555,6 +1585,10 @@ void server_options(char **args,int *arg
+@@ -1547,6 +1577,10 @@ void server_options(char **args,int *arg
argstr[x++] = 'p';
else if (preserve_executability && am_sender)
argstr[x++] = 'E';