if (preserve_hard_links && file->link_u.links) {
if (dry_run)
file->link_u.links->link_dest_used = j + 1;
+@@ -930,7 +937,7 @@ static void recv_generator(char *fname,
+ rsyserr(FERROR, errno,
+ "recv_generator: mkdir %s failed",
+ full_fname(fname));
+- file->flags |= FLAG_MISSING;
++ FFLAGS(file) |= FLAG_MISSING;
+ if (ndx+1 < the_file_list->count
+ && the_file_list->files[ndx+1]->dir.depth > file->dir.depth) {
+ rprintf(FERROR,
@@ -944,7 +951,7 @@ static void recv_generator(char *fname,
&& verbose && code != FNONE && f_out != -1)
rprintf(code, "%s/\n", fname);
}
/* open the file */
+@@ -1514,7 +1521,7 @@ void generate_files(int f_out, struct fi
+ continue;
+ if (!need_retouch_dir_times && file->mode & S_IWUSR)
+ continue;
+- if (file->flags & FLAG_MISSING) {
++ if (FFLAGS(file) & FLAG_MISSING) {
+ int missing = file->dir.depth;
+ while (++i < flist->count) {
+ file = flist->files[i];
--- old/hlink.c
+++ new/hlink.c
@@ -30,6 +30,7 @@ extern int make_backups;
extern int module_id;
extern int ignore_errors;
extern int numeric_ids;
-@@ -693,6 +694,16 @@ static struct file_struct *receive_file_
+@@ -697,6 +698,16 @@ static struct file_struct *receive_file_
sum = empty_sum;
}
read_buf(f, sum, checksum_len);
continue;
best_match = j;
match_level = 2;
-@@ -1210,7 +1214,7 @@ static void recv_generator(char *fname,
+@@ -1212,7 +1216,7 @@ static void recv_generator(char *fname,
;
else if (fnamecmp_type == FNAMECMP_FUZZY)
;
handle_partial_dir(partialptr, PDIR_DELETE);
--- old/hlink.c
+++ new/hlink.c
-@@ -220,7 +220,7 @@ int hard_link_check(struct file_struct *
- itemizing = code = 0;
+@@ -222,7 +222,7 @@ int hard_link_check(struct file_struct *
+ }
break;
}
- if (!unchanged_file(cmpbuf, file, &st3))
+ strlcpy(olddir, curr_dir, sizeof olddir);
+ if (always_checksum && !local_server && argc > 0)
-+ pre_checksum = push_dir(argv[0]);
++ pre_checksum = push_dir(argv[0], 0);
+
flist = recv_file_list(f_in);
verbose = save_verbose;
+ strlcpy(olddir, curr_dir, sizeof olddir);
+ if (always_checksum && !local_server)
-+ pre_checksum = push_dir(argv[0]);
++ pre_checksum = push_dir(argv[0], 0);
+
if (write_batch && !am_server)
start_write_batch(f_in);
--- old/Makefile.in
+++ new/Makefile.in
-@@ -34,7 +34,7 @@ OBJS1=rsync.o generator.o receiver.o cle
+@@ -35,7 +35,7 @@ OBJS1=rsync.o generator.o receiver.o cle
main.o checksum.o match.o syscall.o log.o backup.o
OBJS2=options.o flist.o io.o compat.o hlink.o token.o uidlist.o socket.o \
fileio.o batch.o clientname.o chmod.o
OPT_SERVER, OPT_REFUSED_BASE = 9000};
static struct poptOption long_options[] = {
-@@ -494,6 +496,7 @@ static struct poptOption long_options[]
+@@ -495,6 +497,7 @@ static struct poptOption long_options[]
{"compare-dest", 0, POPT_ARG_STRING, 0, OPT_COMPARE_DEST, 0, 0 },
{"copy-dest", 0, POPT_ARG_STRING, 0, OPT_COPY_DEST, 0, 0 },
{"link-dest", 0, POPT_ARG_STRING, 0, OPT_LINK_DEST, 0, 0 },
{"fuzzy", 'y', POPT_ARG_NONE, &fuzzy_basis, 0, 0, 0 },
{"compress", 'z', POPT_ARG_NONE, 0, 'z', 0, 0 },
{"compress-level", 0, POPT_ARG_INT, &def_compress_level, 'z', 0, 0 },
-@@ -1083,6 +1086,21 @@ int parse_arguments(int *argc, const cha
+@@ -1085,6 +1088,21 @@ int parse_arguments(int *argc, const cha
usage(FINFO);
exit_cleanup(0);
+#if HAVE_LINK
+ arg = poptGetOptArg(pc);
+ if (sanitize_paths)
-+ arg = sanitize_path(NULL, arg, NULL, 0);
++ arg = sanitize_path(NULL, arg, NULL, 0, NULL);
+ link_by_hash_dir = (char *)arg;
+ break;
+#else
default:
/* A large opt value means that set_refuse_options()
* turned this option off. */
-@@ -1737,6 +1755,11 @@ void server_options(char **args,int *arg
+@@ -1735,6 +1753,11 @@ void server_options(char **args,int *arg
}
}
extern char *partial_dir;
extern char *basis_dir[];
extern struct file_list *the_file_list;
-@@ -121,12 +122,13 @@ static int get_tmpname(char *fnametmp, c
+@@ -124,12 +125,13 @@ static int get_tmpname(char *fnametmp, c
static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,
int32 len;
OFF_T offset = 0;
OFF_T offset2;
-@@ -146,6 +148,9 @@ static int receive_data(int f_in, char *
+@@ -149,6 +151,9 @@ static int receive_data(int f_in, char *
} else
mapbuf = NULL;
sum_init(checksum_seed);
if (append_mode) {
-@@ -188,6 +193,8 @@ static int receive_data(int f_in, char *
+@@ -191,6 +196,8 @@ static int receive_data(int f_in, char *
cleanup_got_literal = 1;
sum_update(data, i);
if (fd != -1 && write_file(fd,data,i) != i)
goto report_write_error;
-@@ -214,6 +221,8 @@ static int receive_data(int f_in, char *
+@@ -217,6 +224,8 @@ static int receive_data(int f_in, char *
see_token(map, len);
sum_update(map, len);
+ mdfour_update(&mdfour_data, (uchar*)map, len);
}
- if (inplace) {
-@@ -256,6 +265,8 @@ static int receive_data(int f_in, char *
+ if (updating_basis) {
+@@ -259,6 +268,8 @@ static int receive_data(int f_in, char *
}
sum_end(file_sum1);
if (mapbuf)
unmap_file(mapbuf);
-@@ -271,7 +282,7 @@ static int receive_data(int f_in, char *
+@@ -274,7 +285,7 @@ static int receive_data(int f_in, char *
static void discard_receive_data(int f_in, OFF_T length)
{
}
static void handle_delayed_updates(struct file_list *flist, char *local_name)
-@@ -601,8 +612,12 @@ int recv_files(int f_in, struct file_lis
+@@ -611,8 +622,12 @@ int recv_files(int f_in, struct file_lis
rprintf(FINFO, "%s\n", fname);
/* recv file data */
extern struct stats stats;
extern struct chmod_mode_struct *daemon_chmod_modes;
-@@ -266,8 +267,15 @@ void finish_transfer(char *fname, char *
+@@ -271,8 +272,15 @@ void finish_transfer(char *fname, char *
/* move tmp file over real file */
if (verbose > 2)
rprintf(FINFO, "renaming %s to %s\n", fnametmp, fname);
ret == -2 ? "copy" : "rename",
--- old/rsync.h
+++ new/rsync.h
-@@ -644,6 +644,14 @@ struct stats {
+@@ -651,6 +651,14 @@ struct stats {
int current_file_index;
};
if (exit_code) /* Preserve first error code when recursing. */
code = exit_code;
-@@ -162,8 +155,6 @@ NORETURN void _exit_cleanup(int code, co
+@@ -157,8 +150,6 @@ NORETURN void _exit_cleanup(int code, co
if (cleanup_fname)
do_unlink(cleanup_fname);
}
}
- void io_flush(int flush_it_all)
+-void io_flush(int flush_it_all)
++void io_flush(UNUSED(int flush_it_all))
{
- msg2genr_flush(flush_it_all);
- msg2sndr_flush();
extern int preserve_links;
extern int preserve_hard_links;
extern int preserve_devices;
-@@ -494,7 +495,7 @@ static struct file_struct *receive_file_
+@@ -498,7 +499,7 @@ static struct file_struct *receive_file_
char thisname[MAXPATHLEN];
unsigned int l1 = 0, l2 = 0;
int alloc_len, basename_len, dirname_len, linkname_len, sum_len;
int xtra_len;
#endif
OFF_T file_length;
-@@ -606,10 +607,16 @@ static struct file_struct *receive_file_
+@@ -610,10 +611,16 @@ static struct file_struct *receive_file_
xtra_len = (S_ISDIR(mode) ? 2 : 1) * 4;
else
xtra_len = 0;
+ xtra_len
#endif
+ linkname_len + sum_len;
-@@ -618,7 +625,7 @@ static struct file_struct *receive_file_
+@@ -622,7 +629,7 @@ static struct file_struct *receive_file_
file = (struct file_struct *)bp;
memset(bp, 0, file_struct_len);
bp += file_struct_len;
bp += xtra_len;
#endif
-@@ -719,6 +726,10 @@ static struct file_struct *receive_file_
+@@ -723,6 +730,10 @@ static struct file_struct *receive_file_
if (preserve_acls)
receive_acl(file, f);
#endif
return file;
}
-@@ -989,6 +1000,13 @@ static struct file_struct *send_file_nam
+@@ -994,6 +1005,13 @@ static struct file_struct *send_file_nam
return NULL;
}
#endif
maybe_emit_filelist_progress(flist->count + flist_count_offset);
-@@ -1001,11 +1019,19 @@ static struct file_struct *send_file_nam
+@@ -1006,11 +1024,19 @@ static struct file_struct *send_file_nam
if (preserve_acls)
send_acl(&sx, f);
#endif
{"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 },
-@@ -1113,6 +1123,17 @@ int parse_arguments(int *argc, const cha
+@@ -1114,6 +1124,17 @@ int parse_arguments(int *argc, const cha
return 0;
#endif
default:
/* A large opt value means that set_refuse_options()
-@@ -1563,6 +1584,10 @@ void server_options(char **args,int *arg
+@@ -1560,6 +1581,10 @@ void server_options(char **args,int *arg
if (preserve_acls)
argstr[x++] = 'A';
#endif
#define GID_NONE ((gid_t)-1)
#define HL_CHECK_MASTER 0
-@@ -693,6 +697,9 @@ typedef struct {
+@@ -695,6 +699,9 @@ typedef struct {
struct rsync_acl *acc_acl; /* access ACL */
struct rsync_acl *def_acl; /* default ACL */
#endif
-o, --owner preserve owner (super-user only)
-g, --group preserve group
--devices preserve device files (super-user only)
-@@ -812,6 +813,11 @@ version makes it incompatible with sendi
+@@ -810,6 +811,11 @@ version makes it incompatible with sendi
rsync unless you double the bf(--acls) option (e.g. bf(-AA)). This
doubling is not needed when pulling files from an older rsync.
transfer. The resulting value is treated as though it was the permissions
--- old/xattr.c
+++ new/xattr.c
-@@ -0,0 +1,358 @@
+@@ -0,0 +1,360 @@
+/*
+ * Extended Attribute support for rsync.
+ * Written by Jay Fenlason, vaguely based on the ACLs patch.
+static void rsync_xal_store(item_list *xalp)
+{
+ item_list *new_lst = EXPAND_ITEM_LIST(&rsync_xal_l, item_list, RSYNC_XAL_LIST_INITIAL);
-+ EXPAND_ITEM_LIST(new_lst, item_list, xalp->count);
++ /* Since the following call starts a new list, we know it will hold the
++ * entire initial-count, not just enough space for one new item. */
++ (void)EXPAND_ITEM_LIST(new_lst, item_list, xalp->count);
+ memcpy(new_lst->items, xalp->items, xalp->count * sizeof (item_list));
+ new_lst->count = xalp->count;
+ xalp->count = 0;