robust_unlink(fname); /* Just in case... */
--- old/configure.in
+++ new/configure.in
-@@ -482,6 +482,11 @@ if test x"$ac_cv_func_strcasecmp" = x"no
+@@ -490,6 +490,11 @@ if test x"$ac_cv_func_strcasecmp" = x"no
AC_CHECK_LIB(resolv, strcasecmp)
fi
dnl At the moment we don't test for a broken memcmp(), because all we
dnl need to do is test for equality, not comparison, and it seems that
dnl every platform has a memcmp that can do at least that.
-@@ -746,6 +751,78 @@ AC_SUBST(OBJ_RESTORE)
+@@ -754,6 +759,78 @@ AC_SUBST(OBJ_RESTORE)
AC_SUBST(CC_SHOBJ_FLAG)
AC_SUBST(BUILD_POPT)
file->modtime = modtime;
file->length = file_length;
-@@ -693,6 +713,11 @@ static struct file_struct *receive_file_
+@@ -695,6 +715,11 @@ static struct file_struct *receive_file_
read_buf(f, sum, checksum_len);
}
return file;
}
-@@ -942,6 +967,9 @@ static struct file_struct *send_file_nam
+@@ -944,6 +969,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);
-@@ -951,6 +979,15 @@ static struct file_struct *send_file_nam
+@@ -953,6 +981,15 @@ static struct file_struct *send_file_nam
if (chmod_modes && !S_ISLNK(file->mode))
file->mode = tweak_mode(file->mode, chmod_modes);
maybe_emit_filelist_progress(flist->count + flist_count_offset);
flist_expand(flist);
-@@ -958,6 +995,15 @@ static struct file_struct *send_file_nam
+@@ -960,6 +997,15 @@ static struct file_struct *send_file_nam
if (file->basename[0]) {
flist->files[flist->count++] = file;
send_file_entry(file, f);
maybe_ATTRS_REPORT);
if (preserve_hard_links
&& file->link_u.links) {
-@@ -991,9 +1043,9 @@ static void recv_generator(char *fname,
+@@ -993,9 +1045,9 @@ static void recv_generator(char *fname,
}
/* Not the right symlink (or not a symlink), so
* delete it. */
statret = -1;
} else if (basis_dir[0] != NULL) {
if (try_dests_non(file, fname, ndx, itemizing,
-@@ -1009,7 +1061,7 @@ static void recv_generator(char *fname,
+@@ -1011,7 +1063,7 @@ static void recv_generator(char *fname,
}
}
if (preserve_hard_links && file->link_u.links
itemizing, code, HL_SKIP))
return;
if (do_symlink(file->u.link,fname) != 0) {
-@@ -1018,7 +1070,7 @@ static void recv_generator(char *fname,
+@@ -1020,7 +1072,7 @@ static void recv_generator(char *fname,
} else {
set_file_attrs(fname, file, NULL, 0);
if (itemizing) {
ITEM_LOCAL_CHANGE, 0, NULL);
}
if (code && verbose) {
-@@ -1052,18 +1104,22 @@ static void recv_generator(char *fname,
+@@ -1051,18 +1103,22 @@ static void recv_generator(char *fname,
itemizing = code = 0;
}
}
statret = -1;
if (verbose > 2) {
rprintf(FINFO,"mknod(%s,0%o,0x%x)\n",
-@@ -1076,7 +1132,7 @@ static void recv_generator(char *fname,
+@@ -1075,7 +1131,7 @@ static void recv_generator(char *fname,
} else {
set_file_attrs(fname, file, NULL, 0);
if (itemizing) {
ITEM_LOCAL_CHANGE, 0, NULL);
}
if (code && verbose)
-@@ -1088,12 +1144,12 @@ static void recv_generator(char *fname,
+@@ -1089,14 +1145,14 @@ static void recv_generator(char *fname,
}
} else {
if (itemizing)
+ set_file_attrs(fname, file, &sx, maybe_ATTRS_REPORT);
if (preserve_hard_links && file->link_u.links)
hard_link_cluster(file, ndx, itemizing, code);
+ if (remove_source_files == 1)
+ goto return_with_success;
}
- return;
+ goto cleanup;
}
if (!S_ISREG(file->mode)) {
-@@ -1127,7 +1183,7 @@ static void recv_generator(char *fname,
+@@ -1130,7 +1186,7 @@ static void recv_generator(char *fname,
}
if (update_only && statret == 0
if (verbose > 1)
rprintf(FINFO, "%s is newer\n", fname);
return;
-@@ -1136,18 +1192,18 @@ static void recv_generator(char *fname,
+@@ -1139,20 +1195,20 @@ static void recv_generator(char *fname,
fnamecmp = fname;
fnamecmp_type = FNAMECMP_FNAME;
- int j = try_dests_reg(file, fname, ndx, fnamecmpbuf, &st,
+ int j = try_dests_reg(file, fname, ndx, fnamecmpbuf, &sx,
itemizing, maybe_ATTRS_REPORT, code);
- if (j == -2)
+ if (j == -2) {
+ if (remove_source_files == 1)
+ goto return_with_success;
- return;
+ goto cleanup;
+ }
if (j != -1) {
fnamecmp = fnamecmpbuf;
- fnamecmp_type = j;
-@@ -1156,7 +1212,7 @@ static void recv_generator(char *fname,
+@@ -1162,7 +1218,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
-@@ -1175,7 +1231,7 @@ static void recv_generator(char *fname,
+@@ -1181,7 +1237,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;
-@@ -1184,7 +1240,7 @@ static void recv_generator(char *fname,
+@@ -1190,7 +1246,7 @@ static void recv_generator(char *fname,
if (statret != 0) {
if (preserve_hard_links && file->link_u.links
itemizing, code, HL_SKIP))
return;
if (stat_errno == ENOENT)
-@@ -1194,31 +1250,44 @@ static void recv_generator(char *fname,
+@@ -1200,39 +1256,52 @@ static void recv_generator(char *fname,
return;
}
+ set_file_attrs(fname, file, &sx, maybe_ATTRS_REPORT);
if (preserve_hard_links && file->link_u.links)
hard_link_cluster(file, ndx, itemizing, code);
+ if (remove_source_files != 1)
+- return;
++ goto cleanup;
+ return_with_success:
+ if (!dry_run) {
+ char numbuf[4];
+ SIVAL(numbuf, 0, ndx);
+ send_msg(MSG_SUCCESS, numbuf, 4);
+ }
- return;
+ goto cleanup;
}
fnamecmp = partialptr;
fnamecmp_type = FNAMECMP_PARTIAL_DIR;
statret = 0;
-@@ -1242,17 +1311,21 @@ static void recv_generator(char *fname,
+@@ -1256,17 +1325,21 @@ static void recv_generator(char *fname,
pretend_missing:
/* pretend the file didn't exist */
if (preserve_hard_links && file->link_u.links
}
if (!(back_file = make_file(fname, NULL, NULL, 0, NO_FILTERS))) {
close(fd);
-@@ -1263,7 +1336,7 @@ static void recv_generator(char *fname,
+@@ -1277,7 +1350,7 @@ static void recv_generator(char *fname,
full_fname(backupptr));
free(back_file);
close(fd);
}
if ((f_copy = do_open(backupptr,
O_WRONLY | O_CREAT | O_TRUNC | O_EXCL, 0600)) < 0) {
-@@ -1271,14 +1344,14 @@ static void recv_generator(char *fname,
+@@ -1285,14 +1358,14 @@ static void recv_generator(char *fname,
full_fname(backupptr));
free(back_file);
close(fd);
}
if (verbose > 2)
-@@ -1296,24 +1369,32 @@ static void recv_generator(char *fname,
+@@ -1310,24 +1383,32 @@ 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);
-@@ -1326,6 +1407,13 @@ static void recv_generator(char *fname,
+@@ -1340,6 +1421,13 @@ static void recv_generator(char *fname,
}
close(fd);
}
void generate_files(int f_out, struct file_list *flist, char *local_name)
-@@ -1385,6 +1473,8 @@ void generate_files(int f_out, struct fi
+@@ -1399,6 +1487,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;
--- old/hlink.c
+++ new/hlink.c
-@@ -25,6 +25,7 @@
-
+@@ -26,6 +26,7 @@
extern int verbose;
+ extern int do_xfers;
extern int link_dest;
+extern int preserve_acls;
extern int make_backups;
+ extern int remove_source_files;
extern int stdout_format_has_i;
- extern char *basis_dir[];
-@@ -143,15 +144,19 @@ void init_hard_links(void)
+@@ -145,15 +146,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, "");
}
-@@ -166,13 +171,13 @@ static int maybe_hard_link(struct file_s
+@@ -168,13 +173,13 @@ static int maybe_hard_link(struct file_s
return -1;
}
}
enum logcode code, int skip)
{
#ifdef SUPPORT_HARD_LINKS
-@@ -207,7 +212,7 @@ int hard_link_check(struct file_struct *
+@@ -209,7 +214,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 = code = 0;
break;
-@@ -215,12 +220,16 @@ int hard_link_check(struct file_struct *
+@@ -217,12 +222,16 @@ int hard_link_check(struct file_struct *
if (!unchanged_file(cmpbuf, file, &st3))
continue;
statret = 1;
- maybe_hard_link(file, ndx, fname, statret, st,
+ maybe_hard_link(file, ndx, fname, statret, sxp,
toname, &st2, itemizing, code);
- file->F_HLINDEX = FINISHED_LINK;
- } else
-@@ -233,7 +242,7 @@ int hard_link_check(struct file_struct *
+ if (remove_source_files == 1 && do_xfers) {
+ char numbuf[4];
+@@ -240,7 +249,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)) {
-@@ -249,7 +258,11 @@ int hard_link_one(struct file_struct *fi
+@@ -256,7 +265,11 @@ int hard_link_one(struct file_struct *fi
}
if (itemizing) {
ITEM_LOCAL_CHANGE | ITEM_XNAME_FOLLOWS, 0,
terse ? "" : toname);
}
-@@ -266,11 +279,12 @@ void hard_link_cluster(struct file_struc
+@@ -273,11 +286,12 @@ void hard_link_cluster(struct file_struc
#ifdef SUPPORT_HARD_LINKS
char hlink1[MAXPATHLEN];
char *hlink2;
return;
if (!(file->flags & FLAG_HLINK_TOL)) {
while (!(file->flags & FLAG_HLINK_EOL)) {
-@@ -284,9 +298,13 @@ void hard_link_cluster(struct file_struc
+@@ -291,9 +305,13 @@ void hard_link_cluster(struct file_struc
if (file->F_HLINDEX != SKIPPED_LINK)
continue;
hlink2 = f_name(file, NULL);
+ if (preserve_acls)
+ free_acl(&sx);
+#endif
- file->F_HLINDEX = FINISHED_LINK;
- } while (!(file->flags & FLAG_HLINK_EOL));
- #endif
+ if (remove_source_files == 1 && do_xfers) {
+ char numbuf[4];
+ SIVAL(numbuf, 0, ndx);
--- old/lib/sysacls.c
+++ new/lib/sysacls.c
@@ -0,0 +1,3240 @@
+int sys_acl_free_qualifier(void *qual, SMB_ACL_TAG_T tagtype);
--- old/log.c
+++ new/log.c
-@@ -582,8 +582,10 @@ static void log_formatted(enum logcode c
+@@ -609,8 +609,10 @@ static void log_formatted(enum logcode c
n[5] = !(iflags & ITEM_REPORT_PERMS) ? '.' : 'p';
n[6] = !(iflags & ITEM_REPORT_OWNER) ? '.' : 'o';
n[7] = !(iflags & ITEM_REPORT_GROUP) ? '.' : 'g';
{"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 },
-@@ -1083,6 +1095,24 @@ int parse_arguments(int *argc, const cha
+@@ -1084,6 +1096,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. */
-@@ -1528,6 +1558,10 @@ void server_options(char **args,int *arg
+@@ -1529,6 +1559,10 @@ void server_options(char **args,int *arg
if (preserve_hard_links)
argstr[x++] = 'H';
dit(bf(--chmod)) This option tells rsync to apply one or more
comma-separated "chmod" strings to the permission of the files in the
transfer. The resulting value is treated as though it was the permissions
-@@ -1378,8 +1392,8 @@ if the receiving rsync is at least versi
+@@ -1377,8 +1391,8 @@ if the receiving rsync is at least versi
with older versions of rsync, but that also turns on the output of other
verbose messages).
type of update being done, bf(X) is replaced by the file-type, and the
other letters represent attributes that may be output if they are being
modified.
-@@ -1428,7 +1442,11 @@ quote(itemize(
+@@ -1427,7 +1441,11 @@ quote(itemize(
sender's value (requires bf(--owner) and super-user privileges).
it() A bf(g) means the group is different and is being updated to the
sender's value (requires bf(--group) and the authority to set the group).
+#endif /* _SMB_ACLS_H */
--- old/t_stub.c
+++ new/t_stub.c
-@@ -79,3 +79,7 @@ struct filter_list_struct server_filter_
- return NULL;
+@@ -78,3 +78,8 @@ struct filter_list_struct server_filter_
+ {
+ return NULL;
}
-
++
+ const char *who_am_i(void)
+{
-+ return "test";
++ return "test";
+}
--- old/testsuite/acls.test
+++ new/testsuite/acls.test
for (i = 0; i < flist->count; i++)
--- old/util.c
+++ new/util.c
-@@ -1555,3 +1555,31 @@ int bitbag_next_bit(struct bitbag *bb, i
+@@ -1548,3 +1548,31 @@ int bitbag_next_bit(struct bitbag *bb, i
return -1;
}
else
in_del_hier = 0;
}
-@@ -851,12 +874,14 @@ struct file_struct *make_file(char *fnam
+@@ -853,12 +876,14 @@ struct file_struct *make_file(char *fnam
memset(bp, 0, file_struct_len);
bp += file_struct_len;
#ifdef SUPPORT_HARD_LINKS
if (flist && flist->hlink_pool) {
-@@ -969,7 +994,7 @@ static void send_if_directory(int f, str
+@@ -971,7 +996,7 @@ static void send_if_directory(int f, str
char is_dot_dir = fbuf[ol-1] == '.' && (ol == 1 || fbuf[ol-2] == '/');
if (S_ISDIR(file->mode)
void *save_filters;
unsigned int len = strlen(fbuf);
if (len > 1 && fbuf[len-1] == '/')
-@@ -1581,8 +1606,9 @@ static void clean_flist(struct file_list
+@@ -1583,8 +1608,9 @@ static void clean_flist(struct file_list
}
/* Make sure we don't lose track of a user-specified
* top directory. */
clear_file(flist->files[drop], flist);
-@@ -1706,7 +1732,7 @@ static void output_flist(struct file_lis
+@@ -1708,7 +1734,7 @@ static void output_flist(struct file_lis
file->dirname ? file->dirname : "",
file->dirname ? "/" : "", NS(file->basename),
S_ISDIR(file->mode) ? "/" : "", (int)file->mode,
--- old/generator.c
+++ new/generator.c
-@@ -44,6 +44,7 @@ extern int preserve_perms;
+@@ -43,6 +43,7 @@ extern int preserve_perms;
extern int preserve_uid;
extern int preserve_gid;
extern int preserve_times;
extern int omit_dir_times;
extern int delete_mode;
extern int delete_before;
-@@ -90,6 +91,7 @@ extern dev_t filesystem_dev;
+@@ -89,6 +90,7 @@ extern dev_t filesystem_dev;
extern char *backup_dir;
extern char *backup_suffix;
extern int backup_suffix_len;
extern struct file_list *the_file_list;
extern struct filter_list_struct server_filter_list;
-@@ -182,7 +184,7 @@ static int delete_item(char *fname, int
+@@ -181,7 +183,7 @@ static int delete_item(char *fname, int
for (j = dirlist->count; j--; ) {
struct file_struct *fp = dirlist->files[j];
continue;
strlcpy(p, fp->basename, remainder);
-@@ -260,7 +262,7 @@ static void delete_in_dir(struct file_li
+@@ -259,7 +261,7 @@ static void delete_in_dir(struct file_li
filt_array[cur_depth] = push_local_filters(fbuf, dlen);
if (one_file_system) {
filesystem_dev = stp->st_dev;
else if (filesystem_dev != stp->st_dev)
return;
-@@ -272,7 +274,7 @@ static void delete_in_dir(struct file_li
+@@ -271,7 +273,7 @@ static void delete_in_dir(struct file_li
* from the filesystem. */
for (i = dirlist->count; i--; ) {
struct file_struct *fp = dirlist->files[i];
continue;
if (flist_find(flist, fp) < 0) {
f_name(fp, delbuf);
-@@ -298,11 +300,11 @@ static void do_delete_pass(struct file_l
+@@ -297,11 +299,11 @@ static void do_delete_pass(struct file_l
for (j = 0; j < flist->count; j++) {
struct file_struct *file = flist->files[j];
rprintf(FINFO, "deleting in %s\n", fbuf);
if (link_stat(fbuf, &st, keep_dirlinks) < 0
-@@ -346,6 +348,9 @@ void itemize(struct file_struct *file, i
+@@ -345,6 +347,9 @@ void itemize(struct file_struct *file, i
&& (!(iflags & ITEM_XNAME_FOLLOWS) || *xname))
|| (keep_time && cmp_time(file->modtime, st->st_mtime) != 0))
iflags |= ITEM_REPORT_TIME;
if ((file->mode & CHMOD_BITS) != (st->st_mode & CHMOD_BITS))
iflags |= ITEM_REPORT_PERMS;
if (preserve_uid && am_root && file->uid != st->st_uid)
-@@ -547,7 +552,7 @@ static int find_fuzzy(struct file_struct
+@@ -548,7 +553,7 @@ static int find_fuzzy(struct file_struct
uint32 dist;
if (!S_ISREG(fp->mode) || !fp->length
continue;
name = fp->basename;
-@@ -663,6 +668,8 @@ static int try_dests_reg(struct file_str
+@@ -664,6 +669,8 @@ static int try_dests_reg(struct file_str
itemizing && verbose > 1,
code) < 0)
goto try_a_copy;
if (preserve_hard_links && file->link_u.links)
hard_link_cluster(file, ndx, itemizing, code);
} else
-@@ -929,7 +936,7 @@ static void recv_generator(char *fname,
+@@ -941,7 +948,7 @@ static void recv_generator(char *fname,
&& verbose && code && f_out != -1)
rprintf(code, "%s/\n", fname);
if (delete_during && f_out != -1 && !phase && dry_run < 2
delete_in_dir(the_file_list, fname, file, &st);
return;
}
-@@ -1218,7 +1225,7 @@ static void recv_generator(char *fname,
+@@ -1244,7 +1251,7 @@ static void recv_generator(char *fname,
if (fuzzy_dirlist) {
int j = flist_find(fuzzy_dirlist, file);
if (j >= 0) /* don't use changing file as future fuzzy basis */
/* open the file */
--- old/hlink.c
+++ new/hlink.c
-@@ -28,6 +28,7 @@ extern int link_dest;
- extern int make_backups;
+@@ -30,6 +30,7 @@ extern int make_backups;
+ extern int remove_source_files;
extern int stdout_format_has_i;
extern char *basis_dir[];
+extern unsigned int file_struct_len;
extern struct file_list *the_file_list;
#ifdef SUPPORT_HARD_LINKS
-@@ -88,10 +89,10 @@ static void link_idev_data(void)
+@@ -90,10 +91,10 @@ static void link_idev_data(void)
FPTR(cur)->link_u.links = pool_talloc(hlink_pool,
struct hlink, 1, "hlink_list");
hlink_list[to++] = head;
} else
FPTR(cur)->link_u.links = NULL;
-@@ -177,7 +178,7 @@ int hard_link_check(struct file_struct *
+@@ -179,7 +180,7 @@ int hard_link_check(struct file_struct *
{
#ifdef SUPPORT_HARD_LINKS
int head;
head = hlink_list[file->F_HLINDEX] = file->F_NEXT;
else
head = hlink_list[file->F_HLINDEX];
-@@ -272,8 +273,8 @@ void hard_link_cluster(struct file_struc
+@@ -279,8 +280,8 @@ void hard_link_cluster(struct file_struc
file->F_HLINDEX = FINISHED_LINK;
if (link_stat(f_name(file, hlink1), &st1, 0) < 0)
return;
ndx = file->F_NEXT;
file = FPTR(ndx);
}
-@@ -288,6 +289,6 @@ void hard_link_cluster(struct file_struc
- maybe_hard_link(file, ndx, hlink2, statret, &st2,
- hlink1, &st1, itemizing, code);
+@@ -300,6 +301,6 @@ void hard_link_cluster(struct file_struc
+ send_msg(MSG_SUCCESS, numbuf, 4);
+ }
file->F_HLINDEX = FINISHED_LINK;
- } while (!(file->flags & FLAG_HLINK_EOL));
+ } while (!(FFLAGS(file) & FLAG_HLINK_EOL));
+extern int preserve_atimes;
extern int stdout_format_has_i;
extern int stdout_format_has_o_or_i;
- extern int logfile_format_has_o_or_i;
-@@ -594,7 +595,8 @@ static void log_formatted(enum logcode c
+ extern int logfile_format_has_i;
+@@ -609,7 +610,8 @@ static void log_formatted(enum logcode c
n[5] = !(iflags & ITEM_REPORT_PERMS) ? '.' : 'p';
n[6] = !(iflags & ITEM_REPORT_OWNER) ? '.' : 'o';
n[7] = !(iflags & ITEM_REPORT_GROUP) ? '.' : 'g';
int update_only = 0;
int cvs_exclude = 0;
int dry_run = 0;
-@@ -305,8 +306,9 @@ void usage(enum logcode F)
+@@ -309,8 +310,9 @@ void usage(enum logcode F)
rprintf(F," --devices preserve device files (super-user only)\n");
rprintf(F," --specials preserve special files\n");
rprintf(F," -D same as --devices --specials\n");
rprintf(F," --super receiver attempts super-user activities\n");
rprintf(F," -S, --sparse handle sparse files efficiently\n");
rprintf(F," -n, --dry-run show what would have been transferred\n");
-@@ -419,6 +421,9 @@ static struct poptOption long_options[]
+@@ -424,6 +426,9 @@ static struct poptOption long_options[]
{"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 },
else if (preserve_executability && am_sender)
--- old/rsync.c
+++ new/rsync.c
-@@ -35,6 +35,7 @@ extern int dry_run;
- extern int logfile_format_has_i;
+@@ -34,6 +34,7 @@ extern int verbose;
+ extern int dry_run;
extern int preserve_perms;
extern int preserve_executability;
+extern int preserve_atimes;
extern int preserve_times;
extern int omit_dir_times;
extern int am_root;
-@@ -128,6 +129,7 @@ int set_file_attrs(char *fname, struct f
+@@ -127,6 +128,7 @@ int set_file_attrs(char *fname, struct f
int updated = 0;
STRUCT_STAT st2;
int change_uid, change_gid;
if (!st) {
if (dry_run)
-@@ -146,18 +148,33 @@ int set_file_attrs(char *fname, struct f
+@@ -145,18 +147,33 @@ int set_file_attrs(char *fname, struct f
}
}
/* These flags are used in the live flist data. */
-@@ -119,6 +120,7 @@
+@@ -120,6 +121,7 @@
#define ATTRS_REPORT (1<<0)
#define ATTRS_SKIP_MTIME (1<<1)
--super receiver attempts super-user activities
-S, --sparse handle sparse files efficiently
-n, --dry-run show what would have been transferred
-@@ -861,6 +862,12 @@ it is preserving modification times (see
+@@ -862,6 +863,12 @@ it is preserving modification times (see
the directories on the receiving side, it is a good idea to use bf(-O).
This option is inferred if you use bf(--backup) without bf(--backup-dir).
extern struct stats stats;
extern struct file_list *the_file_list;
extern char *stdout_format;
-@@ -129,7 +130,7 @@ void successful_send(int ndx)
-
- file = the_file_list->files[ndx];
- /* The generator might tell us about symlinks we didn't send. */
-- if (!(file->flags & FLAG_SENT) && !S_ISLNK(file->mode))
-+ if (!(FFLAGS(file) & FLAG_SENT) && !S_ISLNK(file->mode))
- return;
- if (file->dir.root) {
- offset = stringjoin(fname, sizeof fname,
-@@ -371,7 +372,7 @@ void send_files(struct file_list *flist,
+@@ -368,7 +369,7 @@ void send_files(struct file_list *flist,
rprintf(FINFO, "sender finished %s\n", fname);
/* Flag that we actually sent this entry. */
#define RERR_MALLOC 22 /* error allocating core memory buffers */
--- old/generator.c
+++ new/generator.c
-@@ -67,7 +67,6 @@ extern OFF_T min_size;
+@@ -66,7 +66,6 @@ extern OFF_T min_size;
extern int io_error;
extern int allowed_lull;
extern int sock_f_out;
extern int protocol_version;
extern int fuzzy_basis;
extern int always_checksum;
-@@ -95,6 +94,11 @@ extern struct filter_list_struct server_
+@@ -94,6 +93,11 @@ extern struct filter_list_struct server_
static int deletion_count = 0; /* used to implement --max-delete */
/* For calling delete_file() */
#define DEL_FORCE_RECURSE (1<<1) /* recurse even w/o --force */
#define DEL_TERSE (1<<3)
-@@ -445,8 +449,8 @@ static void sum_sizes_sqroot(struct sum_
+@@ -444,8 +448,8 @@ static void sum_sizes_sqroot(struct sum_
}
if (protocol_version < 27) {
s2length = SUM_LENGTH;
} else {
int32 c;
-@@ -456,7 +460,7 @@ static void sum_sizes_sqroot(struct sum_
+@@ -455,7 +459,7 @@ static void sum_sizes_sqroot(struct sum_
for (c = blength; c >>= 1 && b; b--) {}
/* add a bit, subtract rollsum, round up. */
s2length = (b + 1 - 32 + 7) / 8; /* --optimize in compiler-- */
s2length = MIN(s2length, SUM_LENGTH);
}
-@@ -490,7 +494,7 @@ static void generate_and_send_sums(int f
+@@ -489,7 +493,7 @@ static void generate_and_send_sums(int f
sum_sizes_sqroot(&sum, len);
write_sum_head(f_out, &sum);
return;
if (len > 0)
-@@ -509,7 +513,7 @@ static void generate_and_send_sums(int f
+@@ -508,7 +512,7 @@ static void generate_and_send_sums(int f
if (f_copy >= 0) {
full_write(f_copy, map, n1);
continue;
}
-@@ -1182,7 +1186,7 @@ static void recv_generator(char *fname,
+@@ -1200,7 +1204,7 @@ static void recv_generator(char *fname,
return;
}
return;
if (fnamecmp_type <= FNAMECMP_BASIS_DIR_HIGH)
-@@ -1237,7 +1241,7 @@ static void recv_generator(char *fname,
+@@ -1263,7 +1267,7 @@ static void recv_generator(char *fname,
goto notify_others;
}
if (!(backupptr = get_backup_name(fname))) {
close(fd);
return;
-@@ -1328,9 +1332,12 @@ void generate_files(int f_out, struct fi
+@@ -1354,9 +1358,12 @@ void generate_files(int f_out, struct fi
int save_ignore_existing = ignore_existing;
int save_ignore_non_existing = ignore_non_existing;
int save_do_progress = do_progress;
if (protocol_version >= 29) {
itemizing = 1;
maybe_ATTRS_REPORT = stdout_format_has_i ? 0 : ATTRS_REPORT;
-@@ -1358,7 +1365,7 @@ void generate_files(int f_out, struct fi
+@@ -1384,7 +1391,7 @@ void generate_files(int f_out, struct fi
do_delete_pass(flist);
do_progress = 0;
whole_file = 0;
if (verbose >= 2) {
rprintf(FINFO, "delta-transmission %s\n",
-@@ -1367,12 +1374,6 @@ void generate_files(int f_out, struct fi
+@@ -1393,12 +1400,6 @@ void generate_files(int f_out, struct fi
: "enabled");
}
for (i = 0; i < flist->count; i++) {
struct file_struct *file = flist->files[i];
-@@ -1416,23 +1417,34 @@ void generate_files(int f_out, struct fi
+@@ -1442,23 +1443,34 @@ void generate_files(int f_out, struct fi
delete_in_dir(NULL, NULL, NULL, NULL);
phase++;
if (local_name)
strlcpy(fbuf, local_name, sizeof fbuf);
else
-@@ -1444,27 +1456,43 @@ void generate_files(int f_out, struct fi
+@@ -1470,27 +1482,43 @@ void generate_files(int f_out, struct fi
phase++;
ignore_non_existing = save_ignore_non_existing;
ignore_existing = save_ignore_existing;
extern int csum_length;
extern int checksum_seed;
extern int protocol_version;
--extern int remove_sent_files;
+-extern int remove_source_files;
extern int preserve_hard_links;
extern char *filesfrom_host;
extern struct stats stats;
- exit_cleanup(RERR_STREAMIO);
- }
- read_loop(fd, buf, 4);
-- if (remove_sent_files)
+- if (remove_source_files)
- decrement_active_files(IVAL(buf,0));
- flist_ndx_push(&redo_list, IVAL(buf,0));
- break;
- exit_cleanup(RERR_STREAMIO);
- }
- read_loop(fd, buf, len);
-- if (remove_sent_files) {
+- if (remove_source_files) {
- decrement_active_files(IVAL(buf,0));
- send_msg(MSG_SUCCESS, buf, len);
- }
extern int allow_8bit_chars;
extern int protocol_version;
extern int preserve_times;
-@@ -73,7 +72,6 @@ struct {
+@@ -75,7 +74,6 @@ struct {
{ RERR_IPC , "error in IPC code" },
{ RERR_CRASHED , "sibling process crashed" },
{ RERR_TERMINATED , "sibling process terminated abnormally" },
{ RERR_SIGNAL , "received SIGINT, SIGTERM, or SIGHUP" },
{ RERR_WAITCHILD , "waitpid() failed" },
{ RERR_MALLOC , "error allocating core memory buffers" },
-@@ -225,8 +223,8 @@ void rwrite(enum logcode code, char *buf
+@@ -242,8 +240,8 @@ void rwrite(enum logcode code, char *buf
if (len < 0)
exit_cleanup(RERR_MESSAGEIO);
-extern int am_generator;
extern int am_daemon;
extern int blocking_io;
- extern int remove_sent_files;
+ extern int remove_source_files;
@@ -93,9 +92,20 @@ struct pid_status {
static time_t starttime, endtime;
return;
if (am_daemon) {
-@@ -650,12 +660,30 @@ static void do_server_sender(int f_in, i
+@@ -658,12 +668,30 @@ static void do_server_sender(int f_in, i
exit_cleanup(0);
}
/* The receiving side mustn't obey this, or an existing symlink that
* points to an identical file won't be replaced by the referent. */
-@@ -664,70 +692,16 @@ static int do_recv(int f_in,int f_out,st
+@@ -672,70 +700,16 @@ static int do_recv(int f_in,int f_out,st
if (preserve_hard_links)
init_hard_links();
generate_files(f_out, flist, local_name);
handle_stats(-1);
-@@ -738,10 +712,13 @@ static int do_recv(int f_in,int f_out,st
+@@ -746,10 +720,13 @@ static int do_recv(int f_in,int f_out,st
}
io_flush(FULL_FLUSH);
}
-@@ -1143,22 +1120,6 @@ static int start_client(int argc, char *
+@@ -1151,22 +1128,6 @@ static int start_client(int argc, char *
return ret;
}
RETSIGTYPE remember_children(UNUSED(int val))
{
#ifdef WNOHANG
-@@ -1250,8 +1211,6 @@ int main(int argc,char *argv[])
+@@ -1258,8 +1219,6 @@ int main(int argc,char *argv[])
# endif
sigact.sa_flags = SA_NOCLDSTOP;
#endif
int keep_partial = 0;
int safe_symlinks = 0;
int copy_unsafe_links = 0;
-@@ -1304,6 +1304,7 @@ int parse_arguments(int *argc, const cha
+@@ -1305,6 +1305,7 @@ int parse_arguments(int *argc, const cha
if (do_progress && !verbose && !log_before_transfer && !am_server)
verbose = 1;
"rename failed for %s (from %s)",
full_fname(fname), partialptr);
} else {
-- if (remove_sent_files
+- if (remove_source_files
- || (preserve_hard_links
- && file->link_u.links)) {
-+ if (remove_sent_files) {
++ if (remove_source_files) {
SIVAL(numbuf, 0, i);
send_msg(MSG_SUCCESS,numbuf,4);
}
cleanup_disable();
if (recv_ok > 0) {
-- if (remove_sent_files
+- if (remove_source_files
- || (preserve_hard_links && file->link_u.links)) {
-+ if (remove_sent_files) {
++ if (remove_source_files) {
+ decrement_active_files(i);
SIVAL(numbuf, 0, i);
send_msg(MSG_SUCCESS, numbuf, 4);
}
--- old/rsync.c
+++ new/rsync.c
-@@ -40,7 +40,6 @@ extern int omit_dir_times;
+@@ -39,7 +39,6 @@ extern int omit_dir_times;
extern int am_root;
extern int am_server;
extern int am_sender;
extern int am_starting_up;
extern int allow_8bit_chars;
extern int preserve_uid;
-@@ -301,5 +300,5 @@ const char *who_am_i(void)
+@@ -300,5 +299,5 @@ const char *who_am_i(void)
{
if (am_starting_up)
return am_server ? "server" : "client";
}
--- old/rsync.h
+++ new/rsync.h
-@@ -168,10 +168,8 @@ enum msgcode {
+@@ -169,10 +169,8 @@ enum msgcode {
MSG_DATA=0, /* raw data on the multiplexed stream */
MSG_ERROR=FERROR, MSG_INFO=FINFO, /* remote logging */
MSG_LOG=FLOG, MSG_SOCKERR=FSOCKERR, /* sibling logging */
};
#include "errcode.h"
-@@ -322,6 +320,7 @@ enum msgcode {
+@@ -323,6 +321,7 @@ enum msgcode {
#endif
#include <assert.h>