+ if (type == SMB_ACL_TYPE_ACCESS)
+ F_ACL(file) = ndx;
+ else
-+ F_DEFACL(file) = ndx;
++ F_DEF_ACL(file) = ndx;
+ racl_list = &default_acl_list;
+ } while (BUMP_TYPE(type) && S_ISDIR(file->mode));
+}
+ if (type == SMB_ACL_TYPE_ACCESS)
+ F_ACL(file) = ndx;
+ else
-+ F_DEFACL(file) = ndx;
++ F_DEF_ACL(file) = ndx;
+ racl = sxp->def_acl;
+ racl_list = &default_acl_list;
+ } while (BUMP_TYPE(type) && S_ISDIR(sxp->st.st_mode));
+ eq = sxp->acc_acl
+ && rsync_acl_equal_enough(sxp->acc_acl, &duo_item->racl, file->mode);
+ } else {
-+ ndx = F_DEFACL(file);
++ ndx = F_DEF_ACL(file);
+ if (ndx < 0 || (size_t)ndx >= default_acl_list.count)
+ continue;
+ duo_item = default_acl_list.items;
/* Check to see if this is a device file, or link */
if ((am_root && preserve_devices && IS_DEVICE(file->mode))
|| (preserve_specials && IS_SPECIAL(file->mode))) {
-@@ -259,7 +280,7 @@ static int keep_backup(const char *fname
+@@ -260,7 +281,7 @@ static int keep_backup(const char *fname
if (robust_move(fname, buf) != 0) {
rsyserr(FERROR, errno, "keep_backup failed: %s -> \"%s\"",
full_fname(fname), buf);
if (always_checksum && S_ISREG(mode))
extra_len += SUM_EXTRA_CNT * EXTRA_LEN;
-@@ -732,6 +741,11 @@ static struct file_struct *recv_file_ent
+@@ -733,6 +742,11 @@ static struct file_struct *recv_file_ent
read_buf(f, bp, checksum_len);
}
return file;
}
-@@ -992,6 +1006,9 @@ static struct file_struct *send_file_nam
+@@ -993,6 +1007,9 @@ static struct file_struct *send_file_nam
unsigned short flags)
{
struct file_struct *file;
file = make_file(fname, flist, stp, flags,
f == -2 ? SERVER_FILTERS : ALL_FILTERS);
-@@ -1001,11 +1018,24 @@ static struct file_struct *send_file_nam
+@@ -1002,11 +1019,24 @@ static struct file_struct *send_file_nam
if (chmod_modes && !S_ISLNK(file->mode))
file->mode = tweak_mode(file->mode, chmod_modes);
extern char *backup_dir;
extern char *backup_suffix;
extern int backup_suffix_len;
-@@ -445,22 +447,27 @@ static void do_delete_pass(struct file_l
+@@ -446,22 +448,27 @@ static void do_delete_pass(struct file_l
rprintf(FINFO, " \r");
}
int32 iflags, uchar fnamecmp_type, const char *xname)
{
if (statret >= 0) { /* A from-dest-dir statret can == 1! */
-@@ -468,20 +475,24 @@ void itemize(struct file_struct *file, i
+@@ -469,20 +476,24 @@ void itemize(struct file_struct *file, i
: S_ISDIR(file->mode) ? !omit_dir_times
: !S_ISLNK(file->mode);
} else
iflags |= ITEM_IS_NEW;
-@@ -733,7 +744,7 @@ void check_for_finished_hlinks(int itemi
+@@ -736,7 +747,7 @@ void check_for_finished_hlinks(int itemi
* 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,
int maybe_ATTRS_REPORT, enum logcode code)
{
int best_match = -1;
-@@ -742,7 +753,7 @@ static int try_dests_reg(struct file_str
+@@ -745,7 +756,7 @@ static int try_dests_reg(struct file_str
do {
pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname);
continue;
switch (match_level) {
case 0:
-@@ -750,16 +761,20 @@ static int try_dests_reg(struct file_str
+@@ -753,16 +764,20 @@ static int try_dests_reg(struct file_str
match_level = 1;
/* FALL THROUGH */
case 1:
continue;
best_match = j;
match_level = 3;
-@@ -774,7 +789,7 @@ static int try_dests_reg(struct file_str
+@@ -777,7 +792,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;
}
-@@ -782,15 +797,20 @@ static int try_dests_reg(struct file_str
+@@ -785,15 +800,20 @@ static int try_dests_reg(struct file_str
#ifdef SUPPORT_HARD_LINKS
if (link_dest) {
int i = itemizing && (verbose > 1 || stdout_format_has_i > 1);
if (verbose > 1 && maybe_ATTRS_REPORT) {
rprintf(FCLIENT, "%s is uptodate\n", fname);
}
-@@ -806,8 +826,13 @@ static int try_dests_reg(struct file_str
+@@ -809,8 +829,13 @@ static int try_dests_reg(struct file_str
}
return -1;
}
set_file_attrs(fname, file, NULL, 0);
if (maybe_ATTRS_REPORT
&& ((!itemizing && verbose && match_level == 2)
-@@ -828,7 +853,7 @@ static int try_dests_reg(struct file_str
+@@ -833,7 +858,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,
int maybe_ATTRS_REPORT, enum logcode code)
{
char lnk[MAXPATHLEN];
-@@ -860,24 +885,24 @@ static int try_dests_non(struct file_str
+@@ -866,24 +891,24 @@ static int try_dests_non(struct file_str
do {
pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname);
continue;
break;
#endif
-@@ -891,7 +916,7 @@ static int try_dests_non(struct file_str
- break;
+@@ -898,7 +923,7 @@ static int try_dests_non(struct file_str
case TYPE_SPECIAL:
case TYPE_DEVICE:
-- if (stp->st_rdev != MAKEDEV(F_DMAJOR(file), F_DMINOR(file)))
-+ if (sxp->st.st_rdev != MAKEDEV(F_DMAJOR(file), F_DMINOR(file)))
+ devp = F_RDEV_P(file);
+- if (stp->st_rdev != MAKEDEV(DEV_MAJOR(devp), DEV_MINOR(devp)))
++ if (sxp->st.st_rdev != MAKEDEV(DEV_MAJOR(devp), DEV_MINOR(devp)))
continue;
break;
#ifdef SUPPORT_LINKS
-@@ -908,7 +933,11 @@ static int try_dests_non(struct file_str
+@@ -915,7 +940,11 @@ static int try_dests_non(struct file_str
match_level = 2;
best_match = j;
}
match_level = 3;
best_match = j;
break;
-@@ -921,7 +950,7 @@ static int try_dests_non(struct file_str
+@@ -928,7 +957,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;
}
-@@ -952,7 +981,15 @@ static int try_dests_non(struct file_str
+@@ -959,7 +988,15 @@ static int try_dests_non(struct file_str
: ITEM_LOCAL_CHANGE
+ (match_level == 3 ? ITEM_XNAME_FOLLOWS : 0);
char *lp = match_level == 3 ? "" : NULL;
}
if (verbose > 1 && maybe_ATTRS_REPORT) {
rprintf(FCLIENT, "%s%s is uptodate\n",
-@@ -965,6 +1002,7 @@ static int try_dests_non(struct file_str
+@@ -972,6 +1009,7 @@ static int try_dests_non(struct file_str
}
static int phase = 0;
/* Acts on the_file_list->file's ndx'th item, whose name is fname. If a dir,
* make sure it exists, and has the right permissions/timestamp info. For
-@@ -986,7 +1024,8 @@ static void recv_generator(char *fname,
+@@ -993,7 +1031,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;
-@@ -1042,6 +1081,9 @@ static void recv_generator(char *fname,
+@@ -1049,6 +1088,9 @@ static void recv_generator(char *fname,
} else if (!dry_run)
return;
}
if (dry_run > 1) {
statret = -1;
stat_errno = ENOENT;
-@@ -1049,7 +1091,7 @@ static void recv_generator(char *fname,
+@@ -1056,7 +1098,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",
-@@ -1061,6 +1103,10 @@ static void recv_generator(char *fname,
+@@ -1068,6 +1110,10 @@ static void recv_generator(char *fname,
}
if (fuzzy_basis)
need_fuzzy_dirlist = 1;
}
parent_dirname = dn;
-@@ -1070,7 +1116,7 @@ static void recv_generator(char *fname,
+@@ -1077,7 +1123,7 @@ static void recv_generator(char *fname,
need_fuzzy_dirlist = 0;
}
keep_dirlinks && S_ISDIR(file->mode));
stat_errno = errno;
}
-@@ -1088,8 +1134,9 @@ static void recv_generator(char *fname,
+@@ -1095,8 +1141,9 @@ static void recv_generator(char *fname,
* mode based on the local permissions and some heuristics. */
if (!preserve_perms) {
int exists = statret == 0
}
if (S_ISDIR(file->mode)) {
-@@ -1098,8 +1145,8 @@ static void recv_generator(char *fname,
+@@ -1105,8 +1152,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;
}
-@@ -1108,14 +1155,14 @@ static void recv_generator(char *fname,
+@@ -1115,14 +1162,14 @@ static void recv_generator(char *fname,
dry_run++;
}
real_ret = statret;
itemizing, maybe_ATTRS_REPORT, code);
if (j == -2) {
itemizing = 0;
-@@ -1124,7 +1171,11 @@ static void recv_generator(char *fname,
+@@ -1131,7 +1178,11 @@ static void recv_generator(char *fname,
statret = 1;
}
if (itemizing && f_out != -1) {
statret ? ITEM_LOCAL_CHANGE : 0, 0, NULL);
}
if (real_ret != 0 && do_mkdir(fname,file->mode) < 0 && errno != EEXIST) {
-@@ -1144,21 +1195,21 @@ static void recv_generator(char *fname,
+@@ -1151,22 +1202,22 @@ static void recv_generator(char *fname,
return;
}
}
+ goto cleanup;
}
+ #ifdef SUPPORT_HARD_LINKS
if (preserve_hard_links && F_IS_HLINKED(file)
- && hard_link_check(file, ndx, fname, statret, &st,
+ && hard_link_check(file, ndx, fname, statret, &sx,
itemizing, code, HL_CHECK_MASTER))
- return;
+ goto cleanup;
+ #endif
if (preserve_links && S_ISLNK(file->mode)) {
- #ifdef SUPPORT_LINKS
-@@ -1177,14 +1228,14 @@ static void recv_generator(char *fname,
+@@ -1186,14 +1237,14 @@ static void recv_generator(char *fname,
char lnk[MAXPATHLEN];
int len;
- set_file_attrs(fname, file, &st, maybe_ATTRS_REPORT);
+ itemize(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))
hard_link_cluster(file, ndx, itemizing, code, -1);
- if (remove_source_files == 1)
-@@ -1193,10 +1244,10 @@ static void recv_generator(char *fname,
+@@ -1204,10 +1255,10 @@ static void recv_generator(char *fname,
}
/* Not the right symlink (or not a symlink), so
* delete it. */
itemizing, maybe_ATTRS_REPORT, code);
if (j == -2) {
#ifndef CAN_HARDLINK_SYMLINK
-@@ -1212,7 +1263,7 @@ static void recv_generator(char *fname,
- statret = 1;
+@@ -1224,7 +1275,7 @@ static void recv_generator(char *fname,
}
+ #ifdef SUPPORT_HARD_LINKS
if (preserve_hard_links && F_IS_HLINKED(file)
- && hard_link_check(file, ndx, fname, -1, &st,
+ && hard_link_check(file, ndx, fname, -1, &sx,
itemizing, code, HL_SKIP))
return;
- if (do_symlink(sl, fname) != 0) {
-@@ -1221,7 +1272,7 @@ static void recv_generator(char *fname,
+ #endif
+@@ -1234,7 +1285,7 @@ static void recv_generator(char *fname,
} else {
set_file_attrs(fname, file, NULL, 0);
if (itemizing) {
ITEM_LOCAL_CHANGE, 0, NULL);
}
if (code != FNONE && verbose)
-@@ -1244,31 +1295,36 @@ static void recv_generator(char *fname,
+@@ -1260,33 +1311,38 @@ static void recv_generator(char *fname,
if (statret == 0) {
char *t;
if (IS_DEVICE(file->mode)) {
+ itemize(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))
hard_link_cluster(file, ndx, itemizing, code, -1);
+ #endif
if (remove_source_files == 1)
goto return_with_success;
- return;
itemizing, maybe_ATTRS_REPORT, code);
if (j == -2) {
#ifndef CAN_HARDLINK_SPECIAL
-@@ -1284,7 +1340,7 @@ static void recv_generator(char *fname,
- statret = 1;
+@@ -1303,7 +1359,7 @@ static void recv_generator(char *fname,
}
+ #ifdef SUPPORT_HARD_LINKS
if (preserve_hard_links && F_IS_HLINKED(file)
- && hard_link_check(file, ndx, fname, -1, &st,
+ && hard_link_check(file, ndx, fname, -1, &sx,
itemizing, code, HL_SKIP))
return;
- if (verbose > 2) {
-@@ -1297,7 +1353,11 @@ static void recv_generator(char *fname,
+ #endif
+@@ -1318,7 +1374,11 @@ static void recv_generator(char *fname,
} else {
set_file_attrs(fname, file, NULL, 0);
if (itemizing) {
ITEM_LOCAL_CHANGE, 0, NULL);
}
if (code != FNONE && verbose)
-@@ -1307,7 +1367,7 @@ static void recv_generator(char *fname,
+@@ -1330,7 +1390,7 @@ static void recv_generator(char *fname,
if (remove_source_files == 1)
goto return_with_success;
}
}
if (!S_ISREG(file->mode)) {
-@@ -1341,7 +1401,7 @@ static void recv_generator(char *fname,
+@@ -1364,7 +1424,7 @@ static void recv_generator(char *fname,
}
if (update_only && statret == 0
if (verbose > 1)
rprintf(FINFO, "%s is newer\n", fname);
return;
-@@ -1350,20 +1410,20 @@ static void recv_generator(char *fname,
+@@ -1373,20 +1433,20 @@ static void recv_generator(char *fname,
fnamecmp = fname;
fnamecmp_type = FNAMECMP_FNAME;
}
if (j >= 0) {
fnamecmp = fnamecmpbuf;
-@@ -1373,7 +1433,7 @@ static void recv_generator(char *fname,
+@@ -1396,7 +1456,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
-@@ -1392,7 +1452,7 @@ static void recv_generator(char *fname,
+@@ -1415,7 +1475,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;
-@@ -1401,7 +1461,7 @@ static void recv_generator(char *fname,
-
+@@ -1425,7 +1485,7 @@ static void recv_generator(char *fname,
if (statret != 0) {
+ #ifdef SUPPORT_HARD_LINKS
if (preserve_hard_links && F_IS_HLINKED(file)
- && hard_link_check(file, ndx, fname, statret, &st,
+ && hard_link_check(file, ndx, fname, statret, &sx,
itemizing, code, HL_SKIP))
return;
- if (stat_errno == ENOENT)
-@@ -1411,36 +1471,49 @@ static void recv_generator(char *fname,
+ #endif
+@@ -1436,38 +1496,51 @@ static void recv_generator(char *fname,
return;
}
}
- set_file_attrs(fname, file, &st, maybe_ATTRS_REPORT);
+ set_file_attrs(fname, file, &sx, maybe_ATTRS_REPORT);
+ #ifdef SUPPORT_HARD_LINKS
if (preserve_hard_links && F_IS_HLINKED(file))
hard_link_cluster(file, ndx, itemizing, code, -1);
+ #endif
if (remove_source_files != 1)
- return;
+ goto cleanup;
fnamecmp = partialptr;
fnamecmp_type = FNAMECMP_PARTIAL_DIR;
statret = 0;
-@@ -1464,17 +1537,21 @@ static void recv_generator(char *fname,
- pretend_missing:
+@@ -1492,18 +1565,22 @@ static void recv_generator(char *fname,
/* pretend the file didn't exist */
+ #ifdef SUPPORT_HARD_LINKS
if (preserve_hard_links && F_IS_HLINKED(file)
- && hard_link_check(file, ndx, fname, statret, &st,
+ && hard_link_check(file, ndx, fname, statret, &sx,
itemizing, code, HL_SKIP))
- return;
+ goto cleanup;
+ #endif
statret = real_ret = -1;
+#ifdef SUPPORT_ACLS
+ if (preserve_acls && ACL_READY(sx))
}
if (!(back_file = make_file(fname, NULL, NULL, 0, NO_FILTERS))) {
close(fd);
-@@ -1485,7 +1562,7 @@ static void recv_generator(char *fname,
+@@ -1514,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) {
-@@ -1493,14 +1570,14 @@ static void recv_generator(char *fname,
+@@ -1522,14 +1599,14 @@ static void recv_generator(char *fname,
full_fname(backupptr));
unmake_file(back_file);
close(fd);
}
if (verbose > 2)
-@@ -1518,24 +1595,32 @@ static void recv_generator(char *fname,
+@@ -1547,8 +1624,16 @@ static void recv_generator(char *fname,
iflags |= ITEM_BASIS_TYPE_FOLLOWS;
if (fnamecmp_type == FNAMECMP_FUZZY)
iflags |= ITEM_XNAME_FOLLOWS;
}
if (!do_xfers) {
+@@ -1556,17 +1641,17 @@ static void recv_generator(char *fname,
if (preserve_hard_links && F_IS_HLINKED(file))
hard_link_cluster(file, ndx, itemizing, code, -1);
+ #endif
- return;
+ goto cleanup;
}
if (f_copy >= 0) {
close(f_copy);
-@@ -1548,6 +1633,13 @@ static void recv_generator(char *fname,
+@@ -1579,6 +1664,13 @@ static void recv_generator(char *fname,
}
close(fd);
}
void generate_files(int f_out, struct file_list *flist, char *local_name)
-@@ -1609,6 +1701,8 @@ void generate_files(int f_out, struct fi
+@@ -1640,6 +1732,8 @@ void generate_files(int f_out, struct fi
* notice that and let us know via the redo pipe (or its closing). */
ignore_timeout = 1;
extern int make_backups;
extern int remove_source_files;
extern int stdout_format_has_i;
-@@ -154,15 +155,19 @@ void init_hard_links(void)
+@@ -150,15 +151,19 @@ void init_hard_links(void)
+ }
- #ifdef SUPPORT_HARD_LINKS
static int maybe_hard_link(struct file_struct *file, int ndx,
-- char *fname, int statret, STRUCT_STAT *st,
-+ char *fname, int statret, statx *sxp,
- char *toname, STRUCT_STAT *to_st,
+- const char *fname, int statret, STRUCT_STAT *stp,
++ const char *fname, int statret, statx *sxp,
+ const char *toname, STRUCT_STAT *to_stp,
int itemizing, enum logcode code)
{
if (statret == 0) {
-- if (st->st_dev == to_st->st_dev
-- && st->st_ino == to_st->st_ino) {
-+ if (sxp->st.st_dev == to_st->st_dev
-+ && sxp->st.st_ino == to_st->st_ino) {
+- if (stp->st_dev == to_stp->st_dev
+- && stp->st_ino == to_stp->st_ino) {
++ if (sxp->st.st_dev == to_stp->st_dev
++ && sxp->st.st_ino == to_stp->st_ino) {
if (itemizing) {
-- itemize(file, ndx, statret, st,
+- itemize(file, ndx, statret, stp,
+#ifdef SUPPORT_ACLS
+ if (preserve_acls && !ACL_READY(*sxp))
+ get_acl(fname, sxp);
ITEM_LOCAL_CHANGE | ITEM_XNAME_FOLLOWS,
0, "");
}
-@@ -177,13 +182,13 @@ static int maybe_hard_link(struct file_s
+@@ -173,12 +178,12 @@ static int maybe_hard_link(struct file_s
return -1;
}
}
-- return hard_link_one(file, ndx, fname, statret, st, toname,
+- return hard_link_one(file, ndx, fname, statret, stp, toname,
+ return hard_link_one(file, ndx, fname, statret, sxp, toname,
0, itemizing, code);
}
- #endif
- int hard_link_check(struct file_struct *file, int ndx, char *fname,
-- int statret, STRUCT_STAT *st, int itemizing,
+ int hard_link_check(struct file_struct *file, int ndx, const char *fname,
+- int statret, STRUCT_STAT *stp, int itemizing,
+ int statret, statx *sxp, int itemizing,
enum logcode code, int skip)
{
- #ifdef SUPPORT_HARD_LINKS
-@@ -227,7 +232,7 @@ int hard_link_check(struct file_struct *
+ int head;
+@@ -221,7 +226,7 @@ int hard_link_check(struct file_struct *
|| st2.st_ino != st3.st_ino)
continue;
statret = 1;
-- st = &st3;
+- stp = &st3;
+ sxp->st = st3;
if (verbose < 2 || !stdout_format_has_i) {
itemizing = 0;
code = FNONE;
-@@ -237,12 +242,16 @@ int hard_link_check(struct file_struct *
+@@ -231,12 +236,16 @@ int hard_link_check(struct file_struct *
if (!unchanged_file(cmpbuf, file, &st3))
continue;
statret = 1;
-- st = &st3;
+- stp = &st3;
- if (unchanged_attrs(file, &st3))
+ sxp->st = st3;
+#ifdef SUPPORT_ACLS
break;
} while (basis_dir[++j] != NULL);
}
-- maybe_hard_link(file, ndx, fname, statret, st,
+- maybe_hard_link(file, ndx, fname, statret, stp,
+ maybe_hard_link(file, ndx, fname, statret, sxp,
toname, &st2, itemizing, code);
if (remove_source_files == 1 && do_xfers)
send_msg_int(MSG_SUCCESS, ndx);
-@@ -257,7 +266,7 @@ int hard_link_check(struct file_struct *
+@@ -249,7 +258,7 @@ int hard_link_check(struct file_struct *
+ }
- #ifdef SUPPORT_HARD_LINKS
- int hard_link_one(struct file_struct *file, int ndx, char *fname,
-- int statret, STRUCT_STAT *st, char *toname, int terse,
-+ int statret, statx *sxp, char *toname, int terse,
+ int hard_link_one(struct file_struct *file, int ndx, const char *fname,
+- int statret, STRUCT_STAT *stp, const char *toname, int terse,
++ int statret, statx *sxp, const char *toname, int terse,
int itemizing, enum logcode code)
{
if (do_link(toname, fname)) {
-@@ -273,7 +282,11 @@ int hard_link_one(struct file_struct *fi
+@@ -265,7 +274,11 @@ int hard_link_one(struct file_struct *fi
}
if (itemizing) {
-- itemize(file, ndx, statret, st,
+- itemize(file, ndx, statret, stp,
+#ifdef SUPPORT_ACLS
+ if (preserve_acls && statret == 0 && !ACL_READY(*sxp))
+ get_acl(fname, sxp);
ITEM_LOCAL_CHANGE | ITEM_XNAME_FOLLOWS, 0,
terse ? "" : toname);
}
-@@ -290,14 +303,15 @@ void hard_link_cluster(struct file_struc
- #ifdef SUPPORT_HARD_LINKS
+@@ -279,14 +292,15 @@ void hard_link_cluster(struct file_struc
+ {
char hlink1[MAXPATHLEN];
char *hlink2;
- STRUCT_STAT st1, st2;
+ statx sx;
+ STRUCT_STAT st;
int statret, ndx = master;
- struct hlist *hl = F_HLIST(file);
+ struct hlist *hl = F_HL_LIST(file);
hl->hlindex = FINISHED_LINK;
if (dry_run)
return;
if (!(file->flags & FLAG_HLINK_FIRST)) {
while (!(file->flags & FLAG_HLINK_LAST)) {
-@@ -313,9 +327,13 @@ void hard_link_cluster(struct file_struc
+@@ -302,9 +316,13 @@ void hard_link_cluster(struct file_struc
if (hl->hlindex != SKIPPED_LINK)
continue;
hlink2 = f_name(file, NULL);
+#ifdef SUPPORT_ACLS
+ const char *parent_dirname = "";
+#endif
- int i, recv_ok;
+ int ndx, recv_ok;
if (verbose > 2)
@@ -550,7 +555,16 @@ int recv_files(int f_in, struct file_lis
#define GID_NONE ((gid_t)-1)
#define HL_CHECK_MASTER 0
-@@ -551,10 +559,12 @@ extern int preserve_gid;
+@@ -553,10 +561,12 @@ extern int preserve_gid;
/* When the associated option is on, all entries will have these present: */
#define F_UID(f) REQ_EXTRA(f, preserve_uid)->uid
#define F_GID(f) REQ_EXTRA(f, preserve_gid)->gid
+#define F_ACL(f) REQ_EXTRA(f, preserve_acls)->unum
- /* These are per-entry optional and mutally exclusive: */
- #define F_IDEV(f) OPT_EXTRA(f, LEN64_BUMP(f))->idev
- #define F_HLIST(f) OPT_EXTRA(f, LEN64_BUMP(f))->hlist
-+#define F_DEFACL(f) OPT_EXTRA(f, LEN64_BUMP(f))->unum
+ /* These items are per-entry optional and mutally exclusive: */
+ #define F_HL_IDEV(f) OPT_EXTRA(f, LEN64_BUMP(f))->idev
+ #define F_HL_LIST(f) OPT_EXTRA(f, LEN64_BUMP(f))->hlist
++#define F_DEF_ACL(f) OPT_EXTRA(f, LEN64_BUMP(f))->unum
- /* These are per-entry optional, but always both or neither:
- * (Note: a device doesn't need to use LEN64_BUMP(f).) */
-@@ -689,6 +699,17 @@ struct stats {
+ /* This optional item might follow an F_HL_*() item.
+ * (Note: a device doesn't need to check LEN64_BUMP(f).) */
+@@ -694,6 +704,17 @@ struct stats {
struct chmod_mode_struct;
#include "byteorder.h"
#include "lib/mdfour.h"
#include "lib/wildmatch.h"
-@@ -707,6 +728,16 @@ struct chmod_mode_struct;
+@@ -712,6 +733,16 @@ struct chmod_mode_struct;
#define NORETURN __attribute__((__noreturn__))
#endif