char *rel = fullpath + backup_dir_len;
char *end = rel + strlen(rel);
char *p = end;
-@@ -126,13 +128,24 @@ static int make_bak_dir(char *fullpath)
+@@ -126,15 +128,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. */
full_fname(rel));
} else {
- do_lchown(fullpath, st.st_uid, st.st_gid);
+-#ifdef HAVE_CHMOD
- do_chmod(fullpath, st.st_mode);
+#ifdef SUPPORT_ACLS
+ sx.acc_acl = sx.def_acl = NULL;
+ get_acl(rel, &sx);
+ cache_acl(file, &sx);
+ }
-+#endif
+ #endif
+ set_file_attrs(fullpath, file, NULL, 0);
+ free(file);
}
}
*p = '/';
-@@ -170,15 +183,18 @@ static int robust_move(char *src, char *
+@@ -172,15 +183,18 @@ static int robust_move(char *src, char *
* We will move the file to be deleted into a parallel directory tree. */
static int keep_backup(char *fname)
{
if (!(file = make_file(fname, NULL, NULL, 0, NO_FILTERS)))
return 1; /* the file could have disappeared */
-@@ -186,6 +202,13 @@ static int keep_backup(char *fname)
+@@ -188,6 +202,13 @@ static int keep_backup(char *fname)
if (!(buf = get_backup_name(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))) {
-@@ -254,7 +277,7 @@ static int keep_backup(char *fname)
+@@ -256,7 +277,7 @@ static int keep_backup(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/configure.in
+++ new/configure.in
-@@ -515,6 +515,11 @@ if test x"$ac_cv_func_strcasecmp" = x"no
+@@ -537,6 +537,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.
-@@ -779,6 +784,78 @@ AC_SUBST(OBJ_RESTORE)
+@@ -801,6 +806,78 @@ AC_SUBST(OBJ_RESTORE)
AC_SUBST(CC_SHOBJ_FLAG)
AC_SUBST(BUILD_POPT)
+#endif /* SUPPORT_ACLS */
--- old/log.c
+++ new/log.c
-@@ -611,8 +611,10 @@ static void log_formatted(enum logcode c
+@@ -614,8 +614,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';
default:
/* A large opt value means that set_refuse_options()
* turned this option off. */
-@@ -1530,6 +1559,10 @@ void server_options(char **args,int *arg
+@@ -1531,6 +1560,10 @@ void server_options(char **args,int *arg
if (preserve_hard_links)
argstr[x++] = 'H';
}
-@@ -100,6 +115,7 @@ void file_checksum(char *fname,char *sum
- int fd;
- OFF_T len = size;
+@@ -99,6 +114,7 @@ void file_checksum(char *fname,char *sum
+ OFF_T i, len = size;
struct mdfour m;
+ int32 remainder;
+ md5_context ctx;
+ int fd;
memset(sum,0,MD4_SUM_LENGTH);
-
-@@ -109,21 +125,36 @@ void file_checksum(char *fname,char *sum
+@@ -109,11 +125,19 @@ void file_checksum(char *fname,char *sum
buf = map_file(fd, size, MAX_MAP_SIZE, CSUM_CHUNK);
}
/* Prior to version 27 an incorrect MD4 checksum was computed
- * by failing to call mdfour_tail() for block sizes that
+@@ -121,10 +145,17 @@ void file_checksum(char *fname,char *sum
* are multiples of 64. This is fixed by calling mdfour_update()
* even when there are no more bytes. */
-- if (len - i > 0 || protocol_version >= 27)
-- mdfour_update(&m, (uchar *)map_ptr(buf, i, len-i), len-i);
-+ if (len - i > 0 || protocol_version >= 27) {
+ remainder = (int32)(len - i);
+- if (remainder > 0 || protocol_version >= 27)
+- mdfour_update(&m, (uchar *)map_ptr(buf, i, remainder), remainder);
++ if (remainder > 0 || protocol_version >= 27) {
+ if (use_md5)
-+ md5_update(&ctx, (uchar *)map_ptr(buf, i, len-i), len-i);
++ md5_update(&ctx, (uchar *)map_ptr(buf, i, remainder), remainder);
+ else
-+ mdfour_update(&m, (uchar *)map_ptr(buf, i, len-i), len-i);
++ mdfour_update(&m, (uchar *)map_ptr(buf, i, remainder), remainder);
+ }
- mdfour_result(&m, (uchar *)sum);
close(fd);
unmap_file(buf);
-@@ -133,11 +164,15 @@ void file_checksum(char *fname,char *sum
+@@ -134,11 +165,15 @@ void file_checksum(char *fname,char *sum
static int32 sumresidue;
static char sumrbuf[CSUM_CHUNK];
static struct mdfour md;
sumresidue = 0;
SIVAL(s, 0, seed);
sum_update(s, 4);
-@@ -162,13 +197,19 @@ void sum_update(char *p, int32 len)
+@@ -163,13 +198,19 @@ void sum_update(const char *p, int32 len
if (sumresidue) {
int32 i = CSUM_CHUNK - sumresidue;
memcpy(sumrbuf + sumresidue, p, i);
len -= CSUM_CHUNK;
p += CSUM_CHUNK;
}
-@@ -180,8 +221,15 @@ void sum_update(char *p, int32 len)
+@@ -181,8 +222,15 @@ void sum_update(const char *p, int32 len
void sum_end(char *sum)
{
{"checksum", 'c', POPT_ARG_NONE, &always_checksum, 0, 0, 0 },
{"block-size", 'B', POPT_ARG_LONG, &block_size, 0, 0, 0 },
{"compare-dest", 0, POPT_ARG_STRING, 0, OPT_COMPARE_DEST, 0, 0 },
-@@ -1642,6 +1645,9 @@ void server_options(char **args,int *arg
+@@ -1643,6 +1646,9 @@ void server_options(char **args,int *arg
args[ac++] = arg;
}
return;
if (am_daemon) {
-@@ -683,12 +693,30 @@ static void do_server_sender(int f_in, i
+@@ -684,12 +694,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. */
-@@ -697,70 +725,16 @@ static int do_recv(int f_in,int f_out,st
+@@ -698,70 +726,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);
-@@ -771,10 +745,13 @@ static int do_recv(int f_in,int f_out,st
+@@ -772,10 +746,13 @@ static int do_recv(int f_in,int f_out,st
}
io_flush(FULL_FLUSH);
}
-@@ -1176,22 +1153,6 @@ static int start_client(int argc, char *
+@@ -1177,22 +1154,6 @@ static int start_client(int argc, char *
return ret;
}
RETSIGTYPE remember_children(UNUSED(int val))
{
#ifdef WNOHANG
-@@ -1283,8 +1244,6 @@ int main(int argc,char *argv[])
+@@ -1284,8 +1245,6 @@ int main(int argc,char *argv[])
# endif
sigact.sa_flags = SA_NOCLDSTOP;
#endif
@@ -325,7 +325,7 @@ void match_sums(int f, struct sum_struct
}
if (last_match < s->flength) {
- int32 len = s->flength - last_match;
+ int32 len = (int32)(s->flength - last_match);
- if (buf && do_progress)
+ if (buf && recv_progress)
show_progress(last_match, buf->file_size);
int keep_partial = 0;
int safe_symlinks = 0;
int copy_unsafe_links = 0;
-@@ -1306,6 +1306,7 @@ int parse_arguments(int *argc, const cha
+@@ -1302,6 +1302,7 @@ int parse_arguments(int *argc, const cha
if (do_progress && !verbose && !log_before_transfer && !am_server)
verbose = 1;
@@ -165,7 +165,7 @@ static int receive_data(int f_in, char *
}
if (offset < sum.flength) {
- int32 len = sum.flength - offset;
+ int32 len = (int32)(sum.flength - offset);
- if (do_progress)
+ if (recv_progress)
show_progress(offset, total_size);
+ if (preserve_hard_links && file->link_u.links)
+ push_hlink_num(i);
} else if (!recv_ok) {
- int msgtype = phase || read_batch ? FERROR : FINFO;
+ enum logcode msgtype = phase || read_batch ? FERROR : FINFO;
if (msgtype == FERROR || verbose) {
@@ -681,8 +678,8 @@ int recv_files(int f_in, struct file_lis
errstr, fname, keptstr, redostr);