#if !defined HAVE_LCHMOD && !defined HAVE_SETATTRLIST
if (S_ISLNK(file->mode)) {
;
-@@ -1014,6 +1018,8 @@ static int try_dests_reg(struct file_struct *file, char *fname, int ndx,
+@@ -1015,6 +1019,8 @@ static int try_dests_reg(struct file_struct *file, char *fname, int ndx,
if (link_dest) {
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, ndx, &sxp->st, itemizing, code, j);
if (!maybe_ATTRS_REPORT && (verbose > 1 || stdout_format_has_i > 1)) {
-@@ -1199,6 +1205,7 @@ static int try_dests_non(struct file_struct *file, char *fname, int ndx,
+@@ -1200,6 +1206,7 @@ static int try_dests_non(struct file_struct *file, char *fname, int ndx,
static void list_file_entry(struct file_struct *f)
{
char permbuf[PERMSTRING_SIZE];
double len;
if (!F_IS_ACTIVE(f)) {
-@@ -1213,14 +1220,16 @@ static void list_file_entry(struct file_struct *f)
+@@ -1214,14 +1221,16 @@ static void list_file_entry(struct file_struct *f)
#ifdef SUPPORT_LINKS
if (preserve_links && S_ISLNK(f->mode)) {
f_name(f, NULL));
}
}
-@@ -2052,7 +2061,7 @@ static void touch_up_dirs(struct file_list *flist, int ndx)
+@@ -2056,7 +2065,7 @@ static void touch_up_dirs(struct file_list *flist, int ndx)
STRUCT_STAT st;
if (link_stat(fname, &st, 0) == 0
&& cmp_time(st.st_mtime, file->modtime) != 0)
/* These flags are used in the live flist data. */
-@@ -151,6 +152,7 @@
+@@ -154,6 +155,7 @@
#define ATTRS_REPORT (1<<0)
#define ATTRS_SKIP_MTIME (1<<1)
#define FULL_FLUSH 1
#define NORMAL_FLUSH 0
-@@ -627,12 +629,14 @@ extern int file_extra_cnt;
+@@ -630,12 +632,14 @@ extern int file_extra_cnt;
extern int inc_recurse;
extern int uid_ndx;
extern int gid_ndx;
return memcmp(sum, F_SUM(file), checksum_len) == 0;
}
-@@ -984,7 +988,7 @@ static int try_dests_reg(struct file_struct *file, char *fname, int ndx,
+@@ -985,7 +989,7 @@ static int try_dests_reg(struct file_struct *file, char *fname, int ndx,
match_level = 1;
/* FALL THROUGH */
case 1:
continue;
best_match = j;
match_level = 2;
-@@ -1257,7 +1261,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1258,7 +1262,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
* --ignore-non-existing, daemon exclude, or mkdir failure. */
static struct file_struct *skip_dir = NULL;
static struct file_list *fuzzy_dirlist = NULL;
struct file_struct *fuzzy_file = NULL;
int fd = -1, f_copy = -1;
stat_x sx, real_sx;
-@@ -1346,8 +1350,8 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1347,8 +1351,8 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
flist_free(fuzzy_dirlist);
fuzzy_dirlist = NULL;
}
#ifdef SUPPORT_ACLS
if (!preserve_perms)
dflt_perms = default_perms_for_dir(dn);
-@@ -1355,10 +1359,15 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1356,10 +1360,15 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
}
parent_dirname = dn;
}
statret = link_stat(fname, &sx.st, keep_dirlinks && is_dir);
-@@ -1792,7 +1801,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1793,7 +1802,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
;
else if (fnamecmp_type == FNAMECMP_FUZZY)
;
diff --git a/rsync.h b/rsync.h
--- a/rsync.h
+++ b/rsync.h
-@@ -687,6 +687,10 @@ extern int xattrs_ndx;
+@@ -690,6 +690,10 @@ extern int xattrs_ndx;
#define F_SUM(f) ((char*)OPT_EXTRA(f, LEN64_BUMP(f) + HLINK_BUMP(f) \
+ SUM_EXTRA_CNT - 1))
/* Some utility defines: */
#define F_IS_ACTIVE(f) (f)->basename[0]
#define F_IS_HLINKED(f) ((f)->flags & FLAG_HLINKED)
-@@ -865,6 +869,13 @@ typedef struct {
+@@ -868,6 +872,13 @@ typedef struct {
char fname[1]; /* has variable size */
} relnamecache;
else
file_checksum(fn, st->st_size, sum);
return memcmp(sum, F_SUM(file), checksum_len) == 0;
-@@ -1365,7 +1366,8 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1366,7 +1367,8 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
fuzzy_dirlist = get_dirlist(fnamecmpbuf, -1, 1);
}
if (checksum_files) {
}
need_new_dirscan = 0;
}
-@@ -1515,6 +1517,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1516,6 +1518,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
else
change_local_filter_dir(fname, strlen(fname), F_DEPTH(file));
}
goto cleanup;
}
-@@ -1807,6 +1810,8 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1808,6 +1811,8 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
handle_partial_dir(partialptr, PDIR_DELETE);
}
set_file_attrs(fname, file, &sx, NULL, maybe_ATTRS_REPORT);
if (itemizing)
itemize(fnamecmp, file, ndx, statret, &sx, 0, 0, NULL);
#ifdef SUPPORT_HARD_LINKS
-@@ -2243,6 +2248,7 @@ void generate_files(int f_out, const char *local_name)
+@@ -2247,6 +2252,7 @@ void generate_files(int f_out, const char *local_name)
} else
change_local_filter_dir(fbuf, strlen(fbuf), F_DEPTH(fp));
}
}
for (i = cur_flist->low; i <= cur_flist->high; i++) {
struct file_struct *file = cur_flist->sorted[i];
-@@ -2323,6 +2329,9 @@ void generate_files(int f_out, const char *local_name)
+@@ -2327,6 +2333,9 @@ void generate_files(int f_out, const char *local_name)
wait_for_receiver();
}
diff --git a/rsync.h b/rsync.h
--- a/rsync.h
+++ b/rsync.h
-@@ -871,6 +871,8 @@ typedef struct {
+@@ -874,6 +874,8 @@ typedef struct {
#define CSF_ENABLE (1<<1)
#define CSF_LAX (1<<2)
extern int preserve_specials;
extern int preserve_hard_links;
extern int preserve_executability;
-@@ -1687,7 +1688,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1688,7 +1689,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
goto cleanup;
}
#if !defined HAVE_LCHMOD && !defined HAVE_SETATTRLIST
if (S_ISLNK(file->mode)) {
;
-@@ -1222,6 +1237,7 @@ static int try_dests_non(struct file_struct *file, char *fname, int ndx,
+@@ -1223,6 +1238,7 @@ static int try_dests_non(struct file_struct *file, char *fname, int ndx,
static void list_file_entry(struct file_struct *f)
{
char permbuf[PERMSTRING_SIZE];
double len;
if (!F_IS_ACTIVE(f)) {
-@@ -1236,14 +1252,16 @@ static void list_file_entry(struct file_struct *f)
+@@ -1237,14 +1253,16 @@ static void list_file_entry(struct file_struct *f)
#ifdef SUPPORT_LINKS
if (preserve_links && S_ISLNK(f->mode)) {
f_name(f, NULL));
}
}
-@@ -1335,6 +1353,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1336,6 +1354,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
return;
}
}
#define XMIT_SAME_FLAGS (1<<14) /* protocols ?? - now */
/* These flags are used in the live flist data. */
-@@ -153,6 +154,7 @@
+@@ -156,6 +157,7 @@
#define ATTRS_REPORT (1<<0)
#define ATTRS_SKIP_MTIME (1<<1)
#define ATTRS_DELAY_IMMUTABLE (1<<2)
#define FULL_FLUSH 1
#define NORMAL_FLUSH 0
-@@ -169,7 +171,7 @@
+@@ -172,7 +174,7 @@
#define FNAMECMP_FUZZY 0x83
/* For use by the itemize_changes code */
#define ITEM_REPORT_CHANGE (1<<1)
#define ITEM_REPORT_SIZE (1<<2) /* regular files only */
#define ITEM_REPORT_TIMEFAIL (1<<2) /* symlinks only */
-@@ -652,6 +654,7 @@ extern int file_extra_cnt;
+@@ -655,6 +657,7 @@ extern int file_extra_cnt;
extern int inc_recurse;
extern int uid_ndx;
extern int gid_ndx;
extern int fileflags_ndx;
extern int acls_ndx;
extern int xattrs_ndx;
-@@ -659,6 +662,7 @@ extern int xattrs_ndx;
+@@ -662,6 +665,7 @@ extern int xattrs_ndx;
#define FILE_STRUCT_LEN (offsetof(struct file_struct, basename))
#define EXTRA_LEN (sizeof (union file_extras))
#define PTR_EXTRA_CNT ((sizeof (char *) + EXTRA_LEN - 1) / EXTRA_LEN)
#define DEV_EXTRA_CNT 2
#define DIRNODE_EXTRA_CNT 3
#define SUM_EXTRA_CNT ((MAX_DIGEST_LEN + EXTRA_LEN - 1) / EXTRA_LEN)
-@@ -917,6 +921,7 @@ typedef struct {
+@@ -920,6 +924,7 @@ typedef struct {
typedef struct {
STRUCT_STAT st;
diff --git a/rsync.h b/rsync.h
--- a/rsync.h
+++ b/rsync.h
-@@ -148,6 +148,7 @@
+@@ -151,6 +151,7 @@
#define XFLG_ANCHORED2ABS (1<<2) /* leading slash indicates absolute */
#define XFLG_ABS_IF_SLASH (1<<3) /* leading or interior slash is absolute */
#define XFLG_DIR2WILD3 (1<<4) /* dir/ match gets trailing *** added */
return memcmp(sum, F_SUM(file), checksum_len) == 0;
}
-@@ -2197,6 +2199,9 @@ void generate_files(int f_out, const char *local_name)
+@@ -2201,6 +2203,9 @@ void generate_files(int f_out, const char *local_name)
: "enabled");
}
diff = u_strcmp(fmid->basename, f->basename);
if (diff == 0) {
good_match = mid;
-@@ -1984,6 +1986,21 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1985,6 +1987,21 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
fnamecmp = partialptr;
fnamecmp_type = FNAMECMP_PARTIAL_DIR;
statret = 0;
if (do_progress && !am_server)
rprintf(FINFO, " \r");
-@@ -1225,6 +1373,7 @@ static void list_file_entry(struct file_struct *f)
+@@ -1226,6 +1374,7 @@ static void list_file_entry(struct file_struct *f)
}
}
static int phase = 0;
static int dflt_perms;
-@@ -1501,9 +1650,12 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1502,9 +1651,12 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
}
else if (delete_during && f_out != -1 && !phase
&& !(file->flags & FLAG_MISSING_DIR)) {
change_local_filter_dir(fname, strlen(fname), F_DEPTH(file));
}
goto cleanup;
-@@ -1781,8 +1933,14 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1782,8 +1934,14 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
goto cleanup;
}
#endif
rsyserr(FERROR_XFER, stat_errno, "recv_generator: failed to stat %s",
full_fname(fname));
goto cleanup;
-@@ -2178,6 +2336,12 @@ void generate_files(int f_out, const char *local_name)
+@@ -2182,6 +2340,12 @@ void generate_files(int f_out, const char *local_name)
if (verbose > 2)
rprintf(FINFO, "generator starting pid=%ld\n", (long)getpid());
if (delete_before && !solo_file && cur_flist->used > 0)
do_delete_pass();
if (delete_during == 2) {
-@@ -2188,7 +2352,7 @@ void generate_files(int f_out, const char *local_name)
+@@ -2192,7 +2356,7 @@ void generate_files(int f_out, const char *local_name)
}
do_progress = 0;
whole_file = 0;
if (verbose >= 2) {
rprintf(FINFO, "delta-transmission %s\n",
-@@ -2230,7 +2394,7 @@ void generate_files(int f_out, const char *local_name)
+@@ -2234,7 +2398,7 @@ void generate_files(int f_out, const char *local_name)
dirdev = MAKEDEV(DEV_MAJOR(devp), DEV_MINOR(devp));
} else
dirdev = MAKEDEV(0, 0);
} else
change_local_filter_dir(fbuf, strlen(fbuf), F_DEPTH(fp));
}
-@@ -2274,7 +2438,21 @@ void generate_files(int f_out, const char *local_name)
+@@ -2278,7 +2442,21 @@ void generate_files(int f_out, const char *local_name)
} while ((cur_flist = cur_flist->next) != NULL);
if (delete_during)
extern int ignore_existing;
extern int ignore_non_existing;
extern int inplace;
-@@ -1722,6 +1723,13 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1723,6 +1724,13 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
goto cleanup;
}
fnamecmp = fname;
fnamecmp_type = FNAMECMP_FNAME;
-@@ -2088,6 +2096,7 @@ void check_for_finished_files(int itemizing, enum logcode code, int check_redo)
+@@ -2092,6 +2100,7 @@ void check_for_finished_files(int itemizing, enum logcode code, int check_redo)
ignore_existing = -ignore_existing;
ignore_non_existing = -ignore_non_existing;
update_only = -update_only;
always_checksum = -always_checksum;
size_only = -size_only;
append_mode = -append_mode;
-@@ -2113,6 +2122,7 @@ void check_for_finished_files(int itemizing, enum logcode code, int check_redo)
+@@ -2117,6 +2126,7 @@ void check_for_finished_files(int itemizing, enum logcode code, int check_redo)
ignore_existing = -ignore_existing;
ignore_non_existing = -ignore_non_existing;
update_only = -update_only;
#ifdef SUPPORT_ACLS
if (preserve_acls && !S_ISLNK(file->mode)) {
if (!ACL_READY(*sxp))
-@@ -1438,6 +1461,10 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1439,6 +1462,10 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
file->mode = dest_mode(file->mode, sx.st.st_mode,
dflt_perms, statret == 0);
}
if (statret != 0 && basis_dir[0] != NULL) {
int j = try_dests_non(file, fname, ndx, fnamecmpbuf, &sx,
itemizing, code);
-@@ -1478,10 +1505,15 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1479,10 +1506,15 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
/* We need to ensure that the dirs in the transfer have writable
* permissions during the time we are putting files within them.
* This is then fixed after the transfer is done. */
rsyserr(FERROR_XFER, errno,
"failed to modify permissions on %s",
full_fname(fname));
-@@ -1516,6 +1548,10 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1517,6 +1549,10 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
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)
-@@ -2047,13 +2083,17 @@ static void touch_up_dirs(struct file_list *flist, int ndx)
+@@ -2051,13 +2087,17 @@ static void touch_up_dirs(struct file_list *flist, int ndx)
continue;
fname = f_name(file, NULL);
if (!(file->mode & S_IWUSR))
/* These flags are used in the live flist data. */
-@@ -151,6 +152,7 @@
+@@ -154,6 +155,7 @@
#define ATTRS_REPORT (1<<0)
#define ATTRS_SKIP_MTIME (1<<1)
#define FULL_FLUSH 1
#define NORMAL_FLUSH 0
-@@ -177,6 +179,7 @@
+@@ -180,6 +182,7 @@
#define ITEM_REPORT_GROUP (1<<6)
#define ITEM_REPORT_ACL (1<<7)
#define ITEM_REPORT_XATTR (1<<8)
#define ITEM_BASIS_TYPE_FOLLOWS (1<<11)
#define ITEM_XNAME_FOLLOWS (1<<12)
#define ITEM_IS_NEW (1<<13)
-@@ -457,6 +460,28 @@ typedef unsigned int size_t;
+@@ -460,6 +463,28 @@ typedef unsigned int size_t;
#endif
#endif
/* Find a variable that is either exactly 32-bits or longer.
* If some code depends on 32-bit truncation, it will need to
* take special action in a "#if SIZEOF_INT32 > 4" section. */
-@@ -627,6 +652,7 @@ extern int file_extra_cnt;
+@@ -630,6 +655,7 @@ extern int file_extra_cnt;
extern int inc_recurse;
extern int uid_ndx;
extern int gid_ndx;
extern int acls_ndx;
extern int xattrs_ndx;
-@@ -664,6 +690,11 @@ extern int xattrs_ndx;
+@@ -667,6 +693,11 @@ extern int xattrs_ndx;
/* When the associated option is on, all entries will have these present: */
#define F_OWNER(f) REQ_EXTRA(f, uid_ndx)->unum
#define F_GROUP(f) REQ_EXTRA(f, gid_ndx)->unum
diff --git a/rsync.h b/rsync.h
--- a/rsync.h
+++ b/rsync.h
-@@ -825,6 +825,14 @@ struct stats {
+@@ -828,6 +828,14 @@ struct stats {
int num_transferred_files;
};
iflags |= ITEM_REPORT_GROUP;
#ifdef SUPPORT_ACLS
if (preserve_acls && !S_ISLNK(file->mode)) {
-@@ -1434,7 +1437,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
+@@ -1435,7 +1438,7 @@ static void recv_generator(char *fname, struct file_struct *file, int ndx,
real_sx = sx;
if (file->flags & FLAG_DIR_CREATED)
statret = -1;
#define SYMLINK_PREFIX "/rsyncd-munged/"
#define SYMLINK_PREFIX_LEN ((int)sizeof SYMLINK_PREFIX - 1)
-@@ -544,6 +545,11 @@ typedef unsigned int size_t;
+@@ -547,6 +548,11 @@ typedef unsigned int size_t;
# define SIZEOF_INT64 SIZEOF_OFF_T
#endif
diff --git a/flist.c b/flist.c
--- a/flist.c
+++ b/flist.c
-@@ -1342,6 +1373,7 @@ static struct file_struct *send_file_name(int f, struct file_list *flist,
+@@ -1355,6 +1355,7 @@ static struct file_struct *send_file_name(int f, struct file_list *flist,
#endif
#ifdef SUPPORT_XATTRS
if (preserve_xattrs) {
+ sx.st.st_mode = file->mode;
sx.xattr = NULL;
- if (get_xattr(fname, &sx) < 0)
- return NULL;
+ if (get_xattr(fname, &sx) < 0) {
+ io_error |= IOERR_GENERAL;
diff --git a/xattrs.c b/xattrs.c
--- a/xattrs.c
+++ b/xattrs.c
if (rsync_xal_get(fname, sxp->xattr) < 0) {
free_xattr(sxp);
return -1;
-@@ -856,6 +860,11 @@ int set_xattr(const char *fname, const struct file_struct *file,
+@@ -861,6 +865,11 @@ int set_xattr(const char *fname, const struct file_struct *file,
return -1;
}
diff --git a/rsync.h b/rsync.h
--- a/rsync.h
+++ b/rsync.h
-@@ -609,6 +609,13 @@ struct ht_int64_node {
+@@ -612,6 +612,13 @@ struct ht_int64_node {
#define ACLS_NEED_MASK 1
#endif
diff --git a/rsync.h b/rsync.h
--- a/rsync.h
+++ b/rsync.h
-@@ -190,6 +190,10 @@
+@@ -193,6 +193,10 @@
#define SIGNIFICANT_ITEM_FLAGS (~(\
ITEM_BASIS_TYPE_FOLLOWS | ITEM_XNAME_FOLLOWS | ITEM_LOCAL_CHANGE))
diff --git a/rsync.h b/rsync.h
--- a/rsync.h
+++ b/rsync.h
-@@ -134,6 +134,7 @@
+@@ -137,6 +137,7 @@
#define IOERR_DEL_LIMIT (1<<2)
#define MAX_ARGS 1000