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;
}