extern int preserve_devices;
extern int preserve_specials;
extern int preserve_links;
-@@ -95,7 +96,8 @@ path
+@@ -93,7 +94,8 @@ path
****************************************************************************/
static int make_bak_dir(char *fullpath)
{
char *rel = fullpath + backup_dir_len;
char *end = rel + strlen(rel);
char *p = end;
-@@ -127,15 +129,24 @@ static int make_bak_dir(char *fullpath)
+@@ -125,15 +127,24 @@ static int make_bak_dir(char *fullpath)
if (p >= rel) {
/* Try to transfer the directory settings of the
* actual dir that the files are coming from. */
}
}
*p = '/';
-@@ -173,15 +184,18 @@ static int robust_move(const char *src,
+@@ -171,15 +182,18 @@ static int robust_move(const char *src,
* We will move the file to be deleted into a parallel directory tree. */
static int keep_backup(const char *fname)
{
if (!(file = make_file(fname, NULL, NULL, 0, NO_FILTERS)))
return 1; /* the file could have disappeared */
-@@ -191,6 +205,13 @@ static int keep_backup(const char *fname
+@@ -189,6 +203,13 @@ static int keep_backup(const char *fname
return 0;
}
/* 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))) {
-@@ -261,7 +282,7 @@ static int keep_backup(const char *fname
+@@ -259,7 +280,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);
extern int preserve_links;
extern int preserve_hard_links;
extern int preserve_devices;
-@@ -143,6 +144,8 @@ static void list_file_entry(struct file_
-
+@@ -144,6 +145,8 @@ static void list_file_entry(struct file_
permstring(permbuf, f->mode);
+ len = F_LENGTH(f);
+ /* TODO: indicate '+' if the entry has an ACL. */
+
+ extra_len += (S_ISDIR(mode) ? 2 : 1) * sizeof (union flist_extras);
+#endif
+
- sum_len = always_checksum && S_ISREG(mode) ? MD4_SUM_LENGTH : 0;
+ if (always_checksum && S_ISREG(mode))
+ extra_len += SUM_EXTRA_CNT * EXTRA_LEN;
- alloc_len = file_struct_len + dirname_len + basename_len
-@@ -725,6 +734,11 @@ static struct file_struct *recv_file_ent
+@@ -732,6 +741,11 @@ static struct file_struct *recv_file_ent
read_buf(f, bp, checksum_len);
}
return file;
}
-@@ -969,6 +983,8 @@ void unmake_file(struct file_struct *fil
- {
- union flist_extras *start = (union flist_extras *)file
- - (flist_extra_ndx - 1);
-+ if (preserve_acls && S_ISDIR(file->mode))
-+ start--;
- free(start);
- }
-
-@@ -977,6 +993,9 @@ static struct file_struct *send_file_nam
+@@ -992,6 +1006,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);
-@@ -986,11 +1005,24 @@ static struct file_struct *send_file_nam
+@@ -1001,11 +1018,24 @@ static struct file_struct *send_file_nam
if (chmod_modes && !S_ISLNK(file->mode))
file->mode = tweak_mode(file->mode, chmod_modes);
extern int preserve_links;
extern int preserve_devices;
extern int preserve_specials;
-@@ -89,6 +90,7 @@ extern int one_file_system;
- extern int file_struct_len;
+@@ -87,6 +88,7 @@ extern int force_delete;
+ extern int one_file_system;
extern struct stats stats;
extern dev_t filesystem_dev;
+extern mode_t orig_umask;
extern char *backup_dir;
extern char *backup_suffix;
extern int backup_suffix_len;
-@@ -447,22 +449,27 @@ static void do_delete_pass(struct file_l
+@@ -445,22 +447,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! */
-@@ -470,20 +477,24 @@ void itemize(struct file_struct *file, i
+@@ -468,20 +475,24 @@ void itemize(struct file_struct *file, i
: S_ISDIR(file->mode) ? !omit_dir_times
: !S_ISLNK(file->mode);
-- if (S_ISREG(file->mode) && file->length != st->st_size)
-+ if (S_ISREG(file->mode) && file->length != sxp->st.st_size)
+- if (S_ISREG(file->mode) && F_LENGTH(file) != st->st_size)
++ if (S_ISREG(file->mode) && F_LENGTH(file) != sxp->st.st_size)
iflags |= ITEM_REPORT_SIZE;
if ((iflags & (ITEM_TRANSFER|ITEM_LOCAL_CHANGE) && !keep_time
&& !(iflags & ITEM_MATCHED)
} else
iflags |= ITEM_IS_NEW;
-@@ -735,7 +746,7 @@ void check_for_finished_hlinks(int itemi
+@@ -733,7 +744,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;
-@@ -744,7 +755,7 @@ static int try_dests_reg(struct file_str
+@@ -742,7 +753,7 @@ static int try_dests_reg(struct file_str
do {
pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname);
continue;
switch (match_level) {
case 0:
-@@ -752,16 +763,20 @@ static int try_dests_reg(struct file_str
+@@ -750,16 +761,20 @@ static int try_dests_reg(struct file_str
match_level = 1;
/* FALL THROUGH */
case 1:
continue;
best_match = j;
match_level = 3;
-@@ -776,7 +791,7 @@ static int try_dests_reg(struct file_str
+@@ -774,7 +789,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;
}
-@@ -784,15 +799,20 @@ static int try_dests_reg(struct file_str
+@@ -782,15 +797,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 (hard_link_one(file, ndx, fname, 0, sxp,
cmpbuf, 1, i, code) < 0)
goto try_a_copy;
- if (preserve_hard_links && IS_HLINKED(file))
+ if (preserve_hard_links && F_IS_HLINKED(file))
hard_link_cluster(file, ndx, itemizing, code, j);
} else
#endif
if (verbose > 1 && maybe_ATTRS_REPORT) {
rprintf(FCLIENT, "%s is uptodate\n", fname);
}
-@@ -808,8 +828,13 @@ static int try_dests_reg(struct file_str
+@@ -806,8 +826,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)
-@@ -830,7 +855,7 @@ static int try_dests_reg(struct file_str
+@@ -828,7 +853,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];
-@@ -862,24 +887,24 @@ static int try_dests_non(struct file_str
+@@ -860,24 +885,24 @@ static int try_dests_non(struct file_str
do {
pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname);
continue;
break;
#endif
-@@ -893,7 +918,7 @@ static int try_dests_non(struct file_str
+@@ -891,7 +916,7 @@ static int try_dests_non(struct file_str
break;
case TYPE_SPECIAL:
case TYPE_DEVICE:
continue;
break;
#ifdef SUPPORT_LINKS
-@@ -910,7 +935,11 @@ static int try_dests_non(struct file_str
+@@ -908,7 +933,11 @@ static int try_dests_non(struct file_str
match_level = 2;
best_match = j;
}
match_level = 3;
best_match = j;
break;
-@@ -923,7 +952,7 @@ static int try_dests_non(struct file_str
+@@ -921,7 +950,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;
}
-@@ -954,7 +983,15 @@ static int try_dests_non(struct file_str
+@@ -952,7 +981,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",
-@@ -967,6 +1004,7 @@ static int try_dests_non(struct file_str
+@@ -965,6 +1002,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
-@@ -988,7 +1026,8 @@ static void recv_generator(char *fname,
+@@ -986,7 +1024,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;
-@@ -1044,6 +1083,9 @@ static void recv_generator(char *fname,
+@@ -1042,6 +1081,9 @@ static void recv_generator(char *fname,
} else if (!dry_run)
return;
}
if (dry_run > 1) {
statret = -1;
stat_errno = ENOENT;
-@@ -1051,7 +1093,7 @@ static void recv_generator(char *fname,
+@@ -1049,7 +1091,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",
-@@ -1063,6 +1105,10 @@ static void recv_generator(char *fname,
+@@ -1061,6 +1103,10 @@ static void recv_generator(char *fname,
}
if (fuzzy_basis)
need_fuzzy_dirlist = 1;
}
parent_dirname = dn;
-@@ -1072,7 +1118,7 @@ static void recv_generator(char *fname,
+@@ -1070,7 +1116,7 @@ static void recv_generator(char *fname,
need_fuzzy_dirlist = 0;
}
keep_dirlinks && S_ISDIR(file->mode));
stat_errno = errno;
}
-@@ -1090,8 +1136,9 @@ static void recv_generator(char *fname,
+@@ -1088,8 +1134,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)) {
-@@ -1100,8 +1147,8 @@ static void recv_generator(char *fname,
+@@ -1098,8 +1145,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;
}
-@@ -1110,14 +1157,14 @@ static void recv_generator(char *fname,
+@@ -1108,14 +1155,14 @@ static void recv_generator(char *fname,
dry_run++;
}
real_ret = statret;
itemizing, maybe_ATTRS_REPORT, code);
if (j == -2) {
itemizing = 0;
-@@ -1126,7 +1173,11 @@ static void recv_generator(char *fname,
+@@ -1124,7 +1171,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) {
-@@ -1146,21 +1197,21 @@ static void recv_generator(char *fname,
+@@ -1144,21 +1195,21 @@ static void recv_generator(char *fname,
return;
}
}
+ goto cleanup;
}
- if (preserve_hard_links && IS_HLINKED(file)
+ 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))
if (preserve_links && S_ISLNK(file->mode)) {
#ifdef SUPPORT_LINKS
-@@ -1179,14 +1230,14 @@ static void recv_generator(char *fname,
+@@ -1177,14 +1228,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);
- if (preserve_hard_links && IS_HLINKED(file))
+ if (preserve_hard_links && F_IS_HLINKED(file))
hard_link_cluster(file, ndx, itemizing, code, -1);
if (remove_source_files == 1)
-@@ -1195,10 +1246,10 @@ static void recv_generator(char *fname,
+@@ -1193,10 +1244,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
-@@ -1214,7 +1265,7 @@ static void recv_generator(char *fname,
+@@ -1212,7 +1263,7 @@ static void recv_generator(char *fname,
statret = 1;
}
- if (preserve_hard_links && IS_HLINKED(file)
+ 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) {
-@@ -1223,7 +1274,7 @@ static void recv_generator(char *fname,
+@@ -1221,7 +1272,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)
-@@ -1246,31 +1297,36 @@ static void recv_generator(char *fname,
+@@ -1244,31 +1295,36 @@ 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);
- if (preserve_hard_links && IS_HLINKED(file))
+ if (preserve_hard_links && F_IS_HLINKED(file))
hard_link_cluster(file, ndx, itemizing, code, -1);
if (remove_source_files == 1)
goto return_with_success;
itemizing, maybe_ATTRS_REPORT, code);
if (j == -2) {
#ifndef CAN_HARDLINK_SPECIAL
-@@ -1286,7 +1342,7 @@ static void recv_generator(char *fname,
+@@ -1284,7 +1340,7 @@ static void recv_generator(char *fname,
statret = 1;
}
- if (preserve_hard_links && IS_HLINKED(file)
+ 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) {
-@@ -1299,7 +1355,11 @@ static void recv_generator(char *fname,
+@@ -1297,7 +1353,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)
-@@ -1309,7 +1369,7 @@ static void recv_generator(char *fname,
+@@ -1307,7 +1367,7 @@ static void recv_generator(char *fname,
if (remove_source_files == 1)
goto return_with_success;
}
}
if (!S_ISREG(file->mode)) {
-@@ -1343,7 +1403,7 @@ static void recv_generator(char *fname,
+@@ -1341,7 +1401,7 @@ static void recv_generator(char *fname,
}
if (update_only && statret == 0
if (verbose > 1)
rprintf(FINFO, "%s is newer\n", fname);
return;
-@@ -1352,20 +1412,20 @@ static void recv_generator(char *fname,
+@@ -1350,20 +1410,20 @@ static void recv_generator(char *fname,
fnamecmp = fname;
fnamecmp_type = FNAMECMP_FNAME;
}
if (j >= 0) {
fnamecmp = fnamecmpbuf;
-@@ -1375,7 +1435,7 @@ static void recv_generator(char *fname,
+@@ -1373,7 +1433,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
-@@ -1394,7 +1454,7 @@ static void recv_generator(char *fname,
+@@ -1392,7 +1452,7 @@ static void recv_generator(char *fname,
rprintf(FINFO, "fuzzy basis selected for %s: %s\n",
fname, fnamecmpbuf);
}
-- st.st_size = fuzzy_file->length;
-+ sx.st.st_size = fuzzy_file->length;
+- st.st_size = F_LENGTH(fuzzy_file);
++ sx.st.st_size = F_LENGTH(fuzzy_file);
statret = 0;
fnamecmp = fnamecmpbuf;
fnamecmp_type = FNAMECMP_FUZZY;
-@@ -1403,7 +1463,7 @@ static void recv_generator(char *fname,
+@@ -1401,7 +1461,7 @@ static void recv_generator(char *fname,
if (statret != 0) {
- if (preserve_hard_links && IS_HLINKED(file)
+ 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)
-@@ -1413,36 +1473,49 @@ static void recv_generator(char *fname,
+@@ -1411,36 +1471,49 @@ static void recv_generator(char *fname,
return;
}
-- if (append_mode && st.st_size > file->length)
-+ if (append_mode && sx.st.st_size > file->length)
+- if (append_mode && st.st_size > F_LENGTH(file))
++ if (append_mode && sx.st.st_size > F_LENGTH(file))
return;
if (fnamecmp_type <= FNAMECMP_BASIS_DIR_HIGH)
}
- set_file_attrs(fname, file, &st, maybe_ATTRS_REPORT);
+ set_file_attrs(fname, file, &sx, maybe_ATTRS_REPORT);
- if (preserve_hard_links && IS_HLINKED(file))
+ if (preserve_hard_links && F_IS_HLINKED(file))
hard_link_cluster(file, ndx, itemizing, code, -1);
if (remove_source_files != 1)
- return;
fnamecmp = partialptr;
fnamecmp_type = FNAMECMP_PARTIAL_DIR;
statret = 0;
-@@ -1466,17 +1539,21 @@ static void recv_generator(char *fname,
+@@ -1464,17 +1537,21 @@ static void recv_generator(char *fname,
pretend_missing:
/* pretend the file didn't exist */
- if (preserve_hard_links && IS_HLINKED(file)
+ 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))
}
if (!(back_file = make_file(fname, NULL, NULL, 0, NO_FILTERS))) {
close(fd);
-@@ -1487,7 +1564,7 @@ static void recv_generator(char *fname,
+@@ -1485,7 +1562,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) {
-@@ -1495,14 +1572,14 @@ static void recv_generator(char *fname,
+@@ -1493,14 +1570,14 @@ static void recv_generator(char *fname,
full_fname(backupptr));
unmake_file(back_file);
close(fd);
}
if (verbose > 2)
-@@ -1520,24 +1597,32 @@ static void recv_generator(char *fname,
+@@ -1518,24 +1595,32 @@ static void recv_generator(char *fname,
iflags |= ITEM_BASIS_TYPE_FOLLOWS;
if (fnamecmp_type == FNAMECMP_FUZZY)
iflags |= ITEM_XNAME_FOLLOWS;
+ get_acl(fnamecmp, &real_sx);
+#endif
+ itemize(file, -1, real_ret, &real_sx, iflags, fnamecmp_type,
- fuzzy_file ? fuzzy_file->basename : NULL);
+ fuzzy_file ? F_BASENAME(fuzzy_file) : NULL);
+#ifdef SUPPORT_ACLS
+ if (preserve_acls)
+ free_acl(&real_sx);
}
if (!do_xfers) {
- if (preserve_hard_links && IS_HLINKED(file))
+ if (preserve_hard_links && F_IS_HLINKED(file))
hard_link_cluster(file, ndx, itemizing, code, -1);
- return;
+ goto cleanup;
if (f_copy >= 0) {
close(f_copy);
-@@ -1550,6 +1635,13 @@ static void recv_generator(char *fname,
+@@ -1548,6 +1633,13 @@ static void recv_generator(char *fname,
}
close(fd);
}
void generate_files(int f_out, struct file_list *flist, char *local_name)
-@@ -1611,6 +1703,8 @@ void generate_files(int f_out, struct fi
+@@ -1609,6 +1701,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 link_dest;
+extern int preserve_acls;
extern int make_backups;
- extern int flist_extra_ndx;
extern int remove_source_files;
-@@ -155,15 +156,19 @@ void init_hard_links(void)
+ extern int stdout_format_has_i;
+@@ -154,15 +155,19 @@ void init_hard_links(void)
#ifdef SUPPORT_HARD_LINKS
static int maybe_hard_link(struct file_struct *file, int ndx,
ITEM_LOCAL_CHANGE | ITEM_XNAME_FOLLOWS,
0, "");
}
-@@ -178,13 +183,13 @@ static int maybe_hard_link(struct file_s
+@@ -177,13 +182,13 @@ static int maybe_hard_link(struct file_s
return -1;
}
}
enum logcode code, int skip)
{
#ifdef SUPPORT_HARD_LINKS
-@@ -228,7 +233,7 @@ int hard_link_check(struct file_struct *
+@@ -227,7 +232,7 @@ int hard_link_check(struct file_struct *
|| st2.st_ino != st3.st_ino)
continue;
statret = 1;
if (verbose < 2 || !stdout_format_has_i) {
itemizing = 0;
code = FNONE;
-@@ -238,12 +243,16 @@ int hard_link_check(struct file_struct *
+@@ -237,12 +242,16 @@ int hard_link_check(struct file_struct *
if (!unchanged_file(cmpbuf, file, &st3))
continue;
statret = 1;
toname, &st2, itemizing, code);
if (remove_source_files == 1 && do_xfers)
send_msg_int(MSG_SUCCESS, ndx);
-@@ -258,7 +267,7 @@ int hard_link_check(struct file_struct *
+@@ -257,7 +266,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 itemizing, enum logcode code)
{
if (do_link(toname, fname)) {
-@@ -274,7 +283,11 @@ int hard_link_one(struct file_struct *fi
+@@ -273,7 +282,11 @@ int hard_link_one(struct file_struct *fi
}
if (itemizing) {
ITEM_LOCAL_CHANGE | ITEM_XNAME_FOLLOWS, 0,
terse ? "" : toname);
}
-@@ -291,14 +304,15 @@ void hard_link_cluster(struct file_struc
+@@ -290,14 +303,15 @@ void hard_link_cluster(struct file_struc
#ifdef SUPPORT_HARD_LINKS
char hlink1[MAXPATHLEN];
char *hlink2;
return;
if (!(file->flags & FLAG_HLINK_FIRST)) {
while (!(file->flags & FLAG_HLINK_LAST)) {
-@@ -314,9 +328,13 @@ void hard_link_cluster(struct file_struc
+@@ -313,9 +327,13 @@ void hard_link_cluster(struct file_struc
if (hl->hlindex != SKIPPED_LINK)
continue;
hlink2 = f_name(file, NULL);
+#endif /* SUPPORT_ACLS */
--- old/log.c
+++ new/log.c
-@@ -618,8 +618,10 @@ static void log_formatted(enum logcode c
+@@ -625,8 +625,10 @@ static void log_formatted(enum logcode c
c[5] = !(iflags & ITEM_REPORT_PERMS) ? '.' : 'p';
c[6] = !(iflags & ITEM_REPORT_OWNER) ? '.' : 'o';
c[7] = !(iflags & ITEM_REPORT_GROUP) ? '.' : 'g';
/* A large opt value means that set_refuse_options()
* turned this option off. */
@@ -1223,6 +1253,8 @@ int parse_arguments(int *argc, const cha
- preserve_uid = flist_extra_ndx++;
+ preserve_uid = ++flist_extra_cnt;
if (preserve_gid)
- preserve_gid = flist_extra_ndx++;
+ preserve_gid = ++flist_extra_cnt;
+ if (preserve_acls)
-+ preserve_acls = flist_extra_ndx++;
++ preserve_acls = ++flist_extra_cnt;
*argv = poptGetArgs(pc);
*argc = count_args(*argv);
if (preserve_gid)
--- old/receiver.c
+++ new/receiver.c
-@@ -48,6 +48,7 @@ extern int keep_partial;
+@@ -47,6 +47,7 @@ extern int keep_partial;
extern int checksum_seed;
extern int inplace;
extern int delay_updates;
extern struct stats stats;
extern char *stdout_format;
extern char *tmpdir;
-@@ -348,6 +349,10 @@ int recv_files(int f_in, struct file_lis
+@@ -347,6 +348,10 @@ int recv_files(int f_in, struct file_lis
int itemizing = am_server ? logfile_format_has_i : stdout_format_has_i;
enum logcode log_code = log_before_transfer ? FLOG : FINFO;
int max_phase = protocol_version >= 29 ? 2 : 1;
int i, recv_ok;
if (verbose > 2)
-@@ -551,7 +556,16 @@ int recv_files(int f_in, struct file_lis
+@@ -550,7 +555,16 @@ int recv_files(int f_in, struct file_lis
* mode based on the local permissions and some heuristics. */
if (!preserve_perms) {
int exists = fd1 != -1;
--- old/rsync.h
+++ new/rsync.h
-@@ -495,6 +495,14 @@ struct idev {
+@@ -496,6 +496,14 @@ struct idev {
#define IN_LOOPBACKNET 127
#endif
#define GID_NONE ((gid_t)-1)
#define HL_CHECK_MASTER 0
-@@ -540,10 +548,12 @@ union flist_extras {
- /* When enabled, all entries have these: */
- #define F_UID(f) FLIST_EXTRA(f, preserve_uid).uid
- #define F_GID(f) FLIST_EXTRA(f, preserve_gid).gid
-+#define F_ACL(f) FLIST_EXTRA(f, preserve_acls).num
+@@ -551,10 +559,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) FLIST_EXTRA(f, flist_extra_ndx).idev
- #define F_HLIST(f) FLIST_EXTRA(f, flist_extra_ndx).hlist
-+#define F_DEFACL(f) FLIST_EXTRA(f, flist_extra_ndx).num
+ #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 are per-entry optional, but always both or neither: */
- #define F_DMAJOR(f) FLIST_EXTRA(f, flist_extra_ndx + (IS_HLINKED(f)? 1 : 0)).num
-@@ -667,6 +677,17 @@ struct stats {
+ /* 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 {
struct chmod_mode_struct;
#include "byteorder.h"
#include "lib/mdfour.h"
#include "lib/wildmatch.h"
-@@ -685,6 +706,16 @@ struct chmod_mode_struct;
+@@ -707,6 +728,16 @@ struct chmod_mode_struct;
#define NORETURN __attribute__((__noreturn__))
#endif