+#endif /* SUPPORT_ACLS */
--- old/backup.c
+++ new/backup.c
-@@ -23,6 +23,7 @@
+@@ -22,6 +22,7 @@
extern int verbose;
extern int am_root;
extern int preserve_devices;
extern int preserve_specials;
extern int preserve_links;
-@@ -93,7 +94,8 @@ path
+@@ -92,7 +93,8 @@ path
****************************************************************************/
static int make_bak_dir(char *fullpath)
{
char *rel = fullpath + backup_dir_len;
char *end = rel + strlen(rel);
char *p = end;
-@@ -125,15 +127,24 @@ static int make_bak_dir(char *fullpath)
+@@ -124,15 +126,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 = '/';
-@@ -171,15 +182,18 @@ static int robust_move(const char *src,
+@@ -170,15 +181,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 */
-@@ -189,6 +203,13 @@ static int keep_backup(const char *fname
+@@ -188,6 +202,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))) {
-@@ -260,7 +281,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);
robust_unlink(fname); /* Just in case... */
--- old/compat.c
+++ new/compat.c
-@@ -56,6 +56,8 @@ void setup_protocol(int f_out,int f_in)
+@@ -55,6 +55,8 @@ void setup_protocol(int f_out,int f_in)
preserve_uid = ++file_extra_cnt;
if (preserve_gid)
preserve_gid = ++file_extra_cnt;
--- old/flist.c
+++ new/flist.c
-@@ -42,6 +42,7 @@ extern int filesfrom_fd;
+@@ -41,6 +41,7 @@ extern int filesfrom_fd;
extern int one_file_system;
extern int copy_dirlinks;
extern int keep_dirlinks;
extern int preserve_links;
extern int preserve_hard_links;
extern int preserve_devices;
-@@ -153,6 +154,8 @@ static void list_file_entry(struct file_
+@@ -152,6 +153,8 @@ static void list_file_entry(struct file_
permstring(permbuf, f->mode);
len = F_LENGTH(f);
#ifdef SUPPORT_LINKS
if (preserve_links && S_ISLNK(f->mode)) {
rprintf(FINFO, "%s %11.0f %s %s -> %s\n",
-@@ -715,6 +718,12 @@ static struct file_struct *recv_file_ent
+@@ -714,6 +717,12 @@ static struct file_struct *recv_file_ent
}
#endif
if (always_checksum && S_ISREG(mode))
extra_len += SUM_EXTRA_CNT * EXTRA_LEN;
-@@ -852,6 +861,11 @@ static struct file_struct *recv_file_ent
+@@ -851,6 +860,11 @@ static struct file_struct *recv_file_ent
read_buf(f, bp, checksum_len);
}
if (S_ISREG(mode) || S_ISLNK(mode))
stats.total_size += file_length;
-@@ -1123,6 +1137,9 @@ static struct file_struct *send_file_nam
+@@ -1122,6 +1136,9 @@ static struct file_struct *send_file_nam
int flags, int filter_flags)
{
struct file_struct *file;
file = make_file(fname, flist, stp, flags, filter_flags);
if (!file)
-@@ -1131,12 +1148,26 @@ static struct file_struct *send_file_nam
+@@ -1130,12 +1147,26 @@ static struct file_struct *send_file_nam
if (chmod_modes && !S_ISLNK(file->mode))
file->mode = tweak_mode(file->mode, chmod_modes);
--- old/generator.c
+++ new/generator.c
-@@ -36,6 +36,7 @@ extern int do_progress;
+@@ -35,6 +35,7 @@ extern int do_progress;
extern int relative_paths;
extern int implied_dirs;
extern int keep_dirlinks;
extern int preserve_links;
extern int preserve_devices;
extern int preserve_specials;
-@@ -90,6 +91,7 @@ extern int force_delete;
+@@ -89,6 +90,7 @@ extern int force_delete;
extern int one_file_system;
extern struct stats stats;
extern dev_t filesystem_dev;
extern char *backup_dir;
extern char *backup_suffix;
extern int backup_suffix_len;
-@@ -512,22 +514,27 @@ static void do_delete_pass(struct file_l
+@@ -511,22 +513,27 @@ static void do_delete_pass(struct file_l
rprintf(FINFO, " \r");
}
const char *xname)
{
if (statret >= 0) { /* A from-dest-dir statret can == 1! */
-@@ -535,20 +542,24 @@ void itemize(struct file_struct *file, i
+@@ -534,20 +541,24 @@ void itemize(struct file_struct *file, i
: S_ISDIR(file->mode) ? !omit_dir_times
: !S_ISLNK(file->mode);
} else
iflags |= ITEM_IS_NEW;
-@@ -784,7 +795,7 @@ static int find_fuzzy(struct file_struct
+@@ -783,7 +794,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;
-@@ -793,7 +804,7 @@ static int try_dests_reg(struct file_str
+@@ -792,7 +803,7 @@ static int try_dests_reg(struct file_str
do {
pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname);
continue;
switch (match_level) {
case 0:
-@@ -801,16 +812,20 @@ static int try_dests_reg(struct file_str
+@@ -800,16 +811,20 @@ static int try_dests_reg(struct file_str
match_level = 1;
/* FALL THROUGH */
case 1:
continue;
best_match = j;
match_level = 3;
-@@ -825,7 +840,7 @@ static int try_dests_reg(struct file_str
+@@ -824,7 +839,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;
}
-@@ -835,16 +850,25 @@ static int try_dests_reg(struct file_str
+@@ -834,16 +849,25 @@ 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))
if (verbose > 1 && maybe_ATTRS_REPORT)
rprintf(FCLIENT, "%s is uptodate\n", fname);
return -2;
-@@ -861,8 +885,13 @@ static int try_dests_reg(struct file_str
+@@ -860,8 +884,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)
-@@ -873,7 +902,7 @@ static int try_dests_reg(struct file_str
+@@ -872,7 +901,7 @@ static int try_dests_reg(struct file_str
}
#ifdef SUPPORT_HARD_LINKS
if (preserve_hard_links && F_IS_HLINKED(file))
#endif
return -2;
}
-@@ -885,7 +914,7 @@ static int try_dests_reg(struct file_str
+@@ -884,7 +913,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];
-@@ -918,24 +947,24 @@ static int try_dests_non(struct file_str
+@@ -917,24 +946,24 @@ static int try_dests_non(struct file_str
do {
pathjoin(cmpbuf, MAXPATHLEN, basis_dir[j], fname);
continue;
break;
#endif
-@@ -950,7 +979,7 @@ static int try_dests_non(struct file_str
+@@ -949,7 +978,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
-@@ -967,7 +996,11 @@ static int try_dests_non(struct file_str
+@@ -966,7 +995,11 @@ static int try_dests_non(struct file_str
match_level = 2;
best_match = j;
}
match_level = 3;
best_match = j;
break;
-@@ -980,7 +1013,7 @@ static int try_dests_non(struct file_str
+@@ -979,7 +1012,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;
}
-@@ -1011,7 +1044,15 @@ static int try_dests_non(struct file_str
+@@ -1010,7 +1043,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",
-@@ -1024,6 +1065,7 @@ static int try_dests_non(struct file_str
+@@ -1023,6 +1064,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
-@@ -1044,7 +1086,8 @@ static void recv_generator(char *fname,
+@@ -1043,7 +1085,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;
-@@ -1089,6 +1132,9 @@ static void recv_generator(char *fname,
+@@ -1088,6 +1131,9 @@ static void recv_generator(char *fname,
return;
}
}
if (dry_run > 1) {
if (fuzzy_dirlist) {
flist_free(fuzzy_dirlist);
-@@ -1101,7 +1147,7 @@ static void recv_generator(char *fname,
+@@ -1100,7 +1146,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",
-@@ -1113,6 +1159,10 @@ static void recv_generator(char *fname,
+@@ -1112,6 +1158,10 @@ static void recv_generator(char *fname,
}
if (fuzzy_basis)
need_fuzzy_dirlist = 1;
}
parent_dirname = dn;
-@@ -1122,7 +1172,7 @@ static void recv_generator(char *fname,
+@@ -1121,7 +1171,7 @@ static void recv_generator(char *fname,
need_fuzzy_dirlist = 0;
}
keep_dirlinks && S_ISDIR(file->mode));
stat_errno = errno;
}
-@@ -1148,8 +1198,9 @@ static void recv_generator(char *fname,
- * mode based on the local permissions and some heuristics. */
- if (!preserve_perms) {
- int exists = statret == 0
-- && S_ISDIR(st.st_mode) == S_ISDIR(file->mode);
-- file->mode = dest_mode(file->mode, st.st_mode, exists);
-+ && S_ISDIR(sx.st.st_mode) == S_ISDIR(file->mode);
-+ file->mode = dest_mode(file->mode, sx.st.st_mode, dflt_perms,
-+ exists);
- }
-
- if (S_ISDIR(file->mode)) {
-@@ -1158,8 +1209,8 @@ static void recv_generator(char *fname,
+@@ -1149,8 +1199,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;
}
-@@ -1168,14 +1219,14 @@ static void recv_generator(char *fname,
+@@ -1159,7 +1209,7 @@ static void recv_generator(char *fname,
dry_run++;
}
real_ret = statret;
if (new_root_dir) {
if (*fname == '.' && fname[1] == '\0')
statret = -1;
- new_root_dir = 0;
+@@ -1170,7 +1220,7 @@ static void recv_generator(char *fname,
+ statret == 0);
}
if (statret != 0 && basis_dir[0] != NULL) {
- int j = try_dests_non(file, fname, ndx, fnamecmpbuf, &st,
itemizing, code);
if (j == -2) {
itemizing = 0;
-@@ -1184,7 +1235,11 @@ static void recv_generator(char *fname,
+@@ -1179,7 +1229,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) {
-@@ -1198,31 +1253,31 @@ static void recv_generator(char *fname,
+@@ -1193,38 +1247,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;
+ goto cleanup;
}
+ /* If we're not preserving permissions, change the file-list's
+ * mode based on the local permissions and some heuristics. */
+ if (!preserve_perms) {
+- int exists = statret == 0 && !S_ISDIR(st.st_mode);
+- file->mode = dest_mode(file->mode, st.st_mode, exists);
++ int exists = statret == 0 && !S_ISDIR(sx.st.st_mode);
++ file->mode = dest_mode(file->mode, sx.st.st_mode, dflt_perms,
++ exists);
+ }
+
#ifdef SUPPORT_HARD_LINKS
if (preserve_hard_links && F_HLINK_NOT_FIRST(file)
- && hard_link_check(file, ndx, fname, statret, &st, itemizing, code))
#endif
if (preserve_links && S_ISLNK(file->mode)) {
-@@ -1242,28 +1297,28 @@ static void recv_generator(char *fname,
+@@ -1244,28 +1299,28 @@ static void recv_generator(char *fname,
char lnk[MAXPATHLEN];
int len;
itemizing, code);
if (j == -2) {
#ifndef CAN_HARDLINK_SYMLINK
-@@ -1272,7 +1327,7 @@ static void recv_generator(char *fname,
+@@ -1274,7 +1329,7 @@ static void recv_generator(char *fname,
} else
#endif
if (!copy_dest)
itemizing = 0;
code = FNONE;
} else if (j >= 0)
-@@ -1280,7 +1335,7 @@ static void recv_generator(char *fname,
+@@ -1282,7 +1337,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",
-@@ -1288,7 +1343,7 @@ static void recv_generator(char *fname,
+@@ -1290,7 +1345,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)
-@@ -1304,7 +1359,7 @@ static void recv_generator(char *fname,
+@@ -1306,7 +1361,7 @@ static void recv_generator(char *fname,
goto return_with_success;
}
#endif
}
if ((am_root && preserve_devices && IS_DEVICE(file->mode))
-@@ -1314,33 +1369,38 @@ static void recv_generator(char *fname,
+@@ -1316,33 +1371,38 @@ static void recv_generator(char *fname,
if (statret == 0) {
char *t;
if (IS_DEVICE(file->mode)) {
itemizing, code);
if (j == -2) {
#ifndef CAN_HARDLINK_SPECIAL
-@@ -1349,7 +1409,7 @@ static void recv_generator(char *fname,
+@@ -1351,7 +1411,7 @@ static void recv_generator(char *fname,
} else
#endif
if (!copy_dest)
itemizing = 0;
code = FNONE;
} else if (j >= 0)
-@@ -1357,7 +1417,7 @@ static void recv_generator(char *fname,
+@@ -1359,7 +1419,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",
-@@ -1370,7 +1430,11 @@ static void recv_generator(char *fname,
+@@ -1372,7 +1432,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)
-@@ -1382,14 +1446,14 @@ static void recv_generator(char *fname,
+@@ -1384,14 +1448,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) {
-@@ -1398,7 +1462,7 @@ static void recv_generator(char *fname,
+@@ -1400,7 +1464,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) {
-@@ -1406,39 +1470,39 @@ static void recv_generator(char *fname,
+@@ -1408,39 +1472,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;
-@@ -1448,7 +1512,7 @@ static void recv_generator(char *fname,
+@@ -1450,7 +1514,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
-@@ -1467,7 +1531,7 @@ static void recv_generator(char *fname,
+@@ -1469,7 +1533,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;
-@@ -1477,45 +1541,50 @@ static void recv_generator(char *fname,
+@@ -1479,45 +1543,50 @@ static void recv_generator(char *fname,
if (statret != 0) {
#ifdef SUPPORT_HARD_LINKS
if (preserve_hard_links && F_HLINK_NOT_LAST(file))
fnamecmp = partialptr;
fnamecmp_type = FNAMECMP_PARTIAL_DIR;
statret = 0;
-@@ -1540,16 +1609,20 @@ static void recv_generator(char *fname,
+@@ -1542,16 +1611,20 @@ 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))
}
if (!(back_file = make_file(fname, NULL, NULL, 0, NO_FILTERS))) {
close(fd);
-@@ -1560,7 +1633,7 @@ static void recv_generator(char *fname,
+@@ -1562,7 +1635,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) {
-@@ -1568,14 +1641,14 @@ static void recv_generator(char *fname,
+@@ -1570,14 +1643,14 @@ static void recv_generator(char *fname,
full_fname(backupptr));
unmake_file(back_file);
close(fd);
}
if (verbose > 2)
-@@ -1599,26 +1672,34 @@ static void recv_generator(char *fname,
+@@ -1601,26 +1674,34 @@ static void recv_generator(char *fname,
iflags |= ITEM_BASIS_TYPE_FOLLOWS;
if (fnamecmp_type == FNAMECMP_FUZZY)
iflags |= ITEM_XNAME_FOLLOWS;
if (f_copy >= 0) {
close(f_copy);
-@@ -1631,6 +1712,13 @@ static void recv_generator(char *fname,
+@@ -1633,6 +1714,13 @@ static void recv_generator(char *fname,
}
close(fd);
}
static void touch_up_dirs(struct file_list *flist, int ndx)
-@@ -1799,6 +1887,8 @@ void generate_files(int f_out, const cha
+@@ -1803,6 +1891,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;
struct file_struct *fp = dir_flist->files[cur_flist->parent_ndx];
--- old/hlink.c
+++ new/hlink.c
-@@ -27,6 +27,7 @@ extern int verbose;
+@@ -26,6 +26,7 @@ extern int verbose;
extern int dry_run;
extern int do_xfers;
extern int link_dest;
extern int make_backups;
extern int protocol_version;
extern int remove_source_files;
-@@ -268,15 +269,19 @@ void match_hard_links(void)
+@@ -267,15 +268,19 @@ void match_hard_links(void)
}
static int maybe_hard_link(struct file_struct *file, int ndx,
ITEM_LOCAL_CHANGE | ITEM_XNAME_FOLLOWS,
0, "");
}
-@@ -297,7 +302,11 @@ static int maybe_hard_link(struct file_s
+@@ -296,7 +301,11 @@ static int maybe_hard_link(struct file_s
if (hard_link_one(file, fname, oldname, 0)) {
if (itemizing) {
ITEM_LOCAL_CHANGE | ITEM_XNAME_FOLLOWS, 0,
realname);
}
-@@ -311,7 +320,7 @@ static int maybe_hard_link(struct file_s
+@@ -310,7 +319,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;
-@@ -362,18 +371,20 @@ int hard_link_check(struct file_struct *
+@@ -361,18 +370,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;
-@@ -382,16 +393,36 @@ int hard_link_check(struct file_struct *
+@@ -381,16 +392,36 @@ int hard_link_check(struct file_struct *
}
break;
}
realname, itemizing, code) < 0)
return -1;
-@@ -426,7 +457,8 @@ void finish_hard_link(struct file_struct
+@@ -425,7 +456,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);
-@@ -450,14 +482,24 @@ void finish_hard_link(struct file_struct
+@@ -449,14 +481,24 @@ void finish_hard_link(struct file_struct
} else
our_name = fname;
+#endif /* SUPPORT_ACLS */
--- old/log.c
+++ new/log.c
-@@ -625,8 +625,10 @@ static void log_formatted(enum logcode c
+@@ -624,8 +624,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';
char ch = iflags & ITEM_IS_NEW ? '+' : '?';
--- old/options.c
+++ new/options.c
-@@ -47,6 +47,7 @@ int copy_dirlinks = 0;
+@@ -46,6 +46,7 @@ int copy_dirlinks = 0;
int copy_links = 0;
int preserve_links = 0;
int preserve_hard_links = 0;
int preserve_perms = 0;
int preserve_executability = 0;
int preserve_devices = 0;
-@@ -199,6 +200,7 @@ static void print_rsync_version(enum log
+@@ -198,6 +199,7 @@ static void print_rsync_version(enum log
char const *got_socketpair = "no ";
char const *have_inplace = "no ";
char const *hardlinks = "no ";
char const *links = "no ";
char const *ipv6 = "no ";
STRUCT_STAT *dumstat;
-@@ -215,6 +217,10 @@ static void print_rsync_version(enum log
+@@ -214,6 +216,10 @@ static void print_rsync_version(enum log
hardlinks = "";
#endif
#ifdef SUPPORT_LINKS
links = "";
#endif
-@@ -233,8 +239,8 @@ static void print_rsync_version(enum log
+@@ -232,8 +238,8 @@ static void print_rsync_version(enum log
(int)(sizeof (int64) * 8));
rprintf(f, " %ssocketpairs, %shardlinks, %ssymlinks, %sIPv6, batchfiles, %sinplace,\n",
got_socketpair, hardlinks, links, ipv6, have_inplace);
#ifdef MAINTAINER_MODE
rprintf(f, "Panic Action: \"%s\"\n", get_panic_action());
-@@ -280,7 +286,7 @@ void usage(enum logcode F)
+@@ -279,7 +285,7 @@ void usage(enum logcode F)
rprintf(F," -q, --quiet suppress non-error messages\n");
rprintf(F," --no-motd suppress daemon-mode MOTD (see manpage caveat)\n");
rprintf(F," -c, --checksum skip based on checksum, not mod-time & size\n");
rprintf(F," --no-OPTION turn off an implied OPTION (e.g. --no-D)\n");
rprintf(F," -r, --recursive recurse into directories\n");
rprintf(F," -R, --relative use relative path names\n");
-@@ -302,6 +308,9 @@ void usage(enum logcode F)
+@@ -301,6 +307,9 @@ void usage(enum logcode F)
rprintf(F," -p, --perms preserve permissions\n");
rprintf(F," -E, --executability preserve the file's executability\n");
rprintf(F," --chmod=CHMOD affect file and/or directory permissions\n");
rprintf(F," -o, --owner preserve owner (super-user only)\n");
rprintf(F," -g, --group preserve group\n");
rprintf(F," --devices preserve device files (super-user only)\n");
-@@ -422,6 +431,9 @@ static struct poptOption long_options[]
+@@ -421,6 +430,9 @@ static struct poptOption long_options[]
{"no-perms", 0, POPT_ARG_VAL, &preserve_perms, 0, 0, 0 },
{"no-p", 0, POPT_ARG_VAL, &preserve_perms, 0, 0, 0 },
{"executability", 'E', POPT_ARG_NONE, &preserve_executability, 0, 0, 0 },
{"times", 't', POPT_ARG_VAL, &preserve_times, 1, 0, 0 },
{"no-times", 0, POPT_ARG_VAL, &preserve_times, 0, 0, 0 },
{"no-t", 0, POPT_ARG_VAL, &preserve_times, 0, 0, 0 },
-@@ -1093,6 +1105,24 @@ int parse_arguments(int *argc, const cha
+@@ -1092,6 +1104,24 @@ int parse_arguments(int *argc, const cha
usage(FINFO);
exit_cleanup(0);
default:
/* A large opt value means that set_refuse_options()
* turned this option off. */
-@@ -1556,6 +1586,10 @@ void server_options(char **args,int *arg
+@@ -1555,6 +1585,10 @@ void server_options(char **args,int *arg
argstr[x++] = 'p';
else if (preserve_executability && am_sender)
argstr[x++] = 'E';
if (always_checksum)
--- 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 *tmpdir;
extern char *partial_dir;
-@@ -348,6 +349,10 @@ int recv_files(int f_in, char *local_nam
+@@ -347,6 +348,10 @@ int recv_files(int f_in, char *local_nam
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 ndx, recv_ok;
if (verbose > 2)
-@@ -563,7 +568,16 @@ int recv_files(int f_in, char *local_nam
+@@ -562,7 +567,16 @@ int recv_files(int f_in, char *local_nam
* mode based on the local permissions and some heuristics. */
if (!preserve_perms) {
int exists = fd1 != -1;
/* We now check to see if we are writing the file "inplace" */
--- old/rsync.c
+++ new/rsync.c
-@@ -32,6 +32,7 @@
+@@ -31,6 +31,7 @@
extern int verbose;
extern int dry_run;
extern int preserve_perms;
extern int preserve_executability;
extern int preserve_times;
-@@ -50,7 +51,6 @@ extern int inplace;
+@@ -49,7 +50,6 @@ extern int inplace;
extern int flist_eof;
extern int keep_dirlinks;
extern int make_backups;
extern struct file_list *cur_flist, *first_flist, *dir_flist;
extern struct chmod_mode_struct *daemon_chmod_modes;
-@@ -202,7 +202,8 @@ void free_sums(struct sum_struct *s)
+@@ -203,7 +203,8 @@ void free_sums(struct sum_struct *s)
/* This is only called when we aren't preserving permissions. Figure out what
* the permissions should be and return them merged back into the mode. */
{
int new_mode;
/* If the file already exists, we'll return the local permissions,
-@@ -219,56 +220,65 @@ mode_t dest_mode(mode_t flist_mode, mode
+@@ -220,56 +221,65 @@ mode_t dest_mode(mode_t flist_mode, mode
new_mode |= (new_mode & 0444) >> 2;
}
} else {
;
else
#endif
-@@ -278,45 +288,57 @@ int set_file_attrs(char *fname, struct f
+@@ -279,45 +289,57 @@ int set_file_attrs(char *fname, struct f
rprintf(FINFO,
"set uid of %s from %ld to %ld\n",
fname,
}
if (ret == 0) /* ret == 1 if symlink could not be set */
updated = 1;
-@@ -329,6 +351,11 @@ int set_file_attrs(char *fname, struct f
+@@ -330,6 +352,11 @@ int set_file_attrs(char *fname, struct f
else
rprintf(FCLIENT, "%s is uptodate\n", fname);
}
--- old/rsync.h
+++ new/rsync.h
-@@ -546,6 +546,14 @@ struct idev_node {
+@@ -547,6 +547,14 @@ struct idev_node {
#define IN_LOOPBACKNET 127
#endif
#define GID_NONE ((gid_t)-1)
union file_extras {
-@@ -565,6 +573,7 @@ struct file_struct {
+@@ -566,6 +574,7 @@ struct file_struct {
extern int file_extra_cnt;
extern int preserve_uid;
extern int preserve_gid;
#define FILE_STRUCT_LEN (offsetof(struct file_struct, basename))
#define EXTRA_LEN (sizeof (union file_extras))
-@@ -597,10 +606,12 @@ extern int preserve_gid;
+@@ -598,10 +607,12 @@ extern int preserve_gid;
/* When the associated option is on, all entries will have these present: */
#define F_OWNER(f) REQ_EXTRA(f, preserve_uid)->unum
#define F_GROUP(f) REQ_EXTRA(f, preserve_gid)->unum
#define F_DIRDEV_P(f) (&OPT_EXTRA(f, LEN64_BUMP(f) + 2 - 1)->unum)
#define F_DIRNODE_P(f) (&OPT_EXTRA(f, LEN64_BUMP(f) + 3 - 1)->num)
-@@ -752,6 +763,17 @@ struct stats {
+@@ -753,6 +764,17 @@ struct stats {
struct chmod_mode_struct;
#include "byteorder.h"
#include "lib/mdfour.h"
#include "lib/wildmatch.h"
-@@ -770,6 +792,16 @@ struct chmod_mode_struct;
+@@ -771,6 +793,16 @@ struct chmod_mode_struct;
#define NORETURN __attribute__((__noreturn__))
#endif
--- old/uidlist.c
+++ new/uidlist.c
-@@ -36,6 +36,7 @@ extern int verbose;
+@@ -35,6 +35,7 @@ extern int verbose;
extern int am_root;
extern int preserve_uid;
extern int preserve_gid;
extern int numeric_ids;
struct idlist {
-@@ -272,7 +273,7 @@ void send_uid_list(int f)
+@@ -271,7 +272,7 @@ void send_uid_list(int f)
{
struct idlist *list;
int len;
/* we send sequences of uid/byte-length/name */
for (list = uidlist; list; list = list->next) {
-@@ -289,7 +290,7 @@ void send_uid_list(int f)
+@@ -288,7 +289,7 @@ void send_uid_list(int f)
write_int(f, 0);
}
int len;
for (list = gidlist; list; list = list->next) {
if (!list->name)
-@@ -329,18 +330,28 @@ void recv_uid_list(int f, struct file_li
+@@ -328,18 +329,28 @@ void recv_uid_list(int f, struct file_li
{
int id, i;
for (i = 0; i < flist->count; i++)
--- old/util.c
+++ new/util.c
-@@ -1467,3 +1467,31 @@ int bitbag_next_bit(struct bitbag *bb, i
+@@ -1466,3 +1466,31 @@ int bitbag_next_bit(struct bitbag *bb, i
return -1;
}