--- embedaddon/rsync/compat.c 2012/02/17 15:09:30 1.1.1.1 +++ embedaddon/rsync/compat.c 2016/11/01 09:54:32 1.1.1.3 @@ -3,7 +3,7 @@ * * Copyright (C) Andrew Tridgell 1996 * Copyright (C) Paul Mackerras 1996 - * Copyright (C) 2004-2009 Wayne Davison + * Copyright (C) 2004-2015 Wayne Davison * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,8 +26,9 @@ int file_extra_cnt = 0; /* count of file-list extras t int inc_recurse = 0; int compat_flags = 0; int use_safe_inc_flist = 0; +int want_xattr_optim = 0; +int proper_seed_order = 0; -extern int verbose; extern int am_server; extern int am_sender; extern int local_server; @@ -35,6 +36,7 @@ extern int inplace; extern int recurse; extern int use_qsort; extern int allow_inc_recurse; +extern int preallocate_files; extern int append_mode; extern int fuzzy_basis; extern int read_batch; @@ -55,7 +57,7 @@ extern char *partial_dir; extern char *dest_option; extern char *files_from; extern char *filesfrom_host; -extern struct filter_list_struct filter_list; +extern filter_rule_list filter_list; extern int need_unsorted_flist; #ifdef ICONV_OPTION extern iconv_t ic_send, ic_recv; @@ -76,6 +78,8 @@ int filesfrom_convert = 0; #define CF_SYMLINK_TIMES (1<<1) #define CF_SYMLINK_ICONV (1<<2) #define CF_SAFE_FLIST (1<<3) +#define CF_AVOID_XATTR_OPTIM (1<<4) +#define CF_CHKSUM_SEED_FIX (1<<5) static const char *client_info; @@ -163,7 +167,7 @@ void setup_protocol(int f_out,int f_in) exit_cleanup(RERR_PROTOCOL); } - if (verbose > 3) { + if (DEBUG_GTE(PROTO, 1)) { rprintf(FINFO, "(%s) Protocol versions: remote=%d, negotiated=%d\n", am_server? "Server" : "Client", remote_protocol, protocol_version); } @@ -190,6 +194,14 @@ void setup_protocol(int f_out,int f_in) if (read_batch) check_batch_flags(); +#ifndef SUPPORT_PREALLOCATION + if (preallocate_files && !am_sender) { + rprintf(FERROR, "preallocation is not supported on this %s\n", + am_server ? "Server" : "Client"); + exit_cleanup(RERR_SYNTAX); + } +#endif + if (protocol_version < 30) { if (append_mode == 1) append_mode = 2; @@ -259,11 +271,17 @@ void setup_protocol(int f_out,int f_in) #endif if (local_server || strchr(client_info, 'f') != NULL) compat_flags |= CF_SAFE_FLIST; + if (local_server || strchr(client_info, 'x') != NULL) + compat_flags |= CF_AVOID_XATTR_OPTIM; + if (local_server || strchr(client_info, 'C') != NULL) + compat_flags |= CF_CHKSUM_SEED_FIX; write_byte(f_out, compat_flags); } else compat_flags = read_byte(f_in); /* The inc_recurse var MUST be set to 0 or 1. */ inc_recurse = compat_flags & CF_INC_RECURSE ? 1 : 0; + want_xattr_optim = protocol_version >= 31 && !(compat_flags & CF_AVOID_XATTR_OPTIM); + proper_seed_order = compat_flags & CF_CHKSUM_SEED_FIX ? 1 : 0; if (am_sender) { receiver_symlink_times = am_server ? strchr(client_info, 'L') != NULL @@ -285,7 +303,7 @@ void setup_protocol(int f_out,int f_in) read_batch ? "batch file" : "connection"); exit_cleanup(RERR_SYNTAX); } - use_safe_inc_flist = !!(compat_flags & CF_SAFE_FLIST); + use_safe_inc_flist = (compat_flags & CF_SAFE_FLIST) || protocol_version >= 31; need_messages_from_generator = 1; #ifdef CAN_SET_SYMLINK_TIMES } else if (!am_sender) { @@ -297,10 +315,10 @@ void setup_protocol(int f_out,int f_in) unsort_ndx = ++file_extra_cnt; if (partial_dir && *partial_dir != '/' && (!am_server || local_server)) { - int flags = MATCHFLG_NO_PREFIXES | MATCHFLG_DIRECTORY; + int rflags = FILTRULE_NO_PREFIXES | FILTRULE_DIRECTORY; if (!am_sender || protocol_version >= 30) - flags |= MATCHFLG_PERISHABLE; - parse_rule(&filter_list, partial_dir, flags, 0); + rflags |= FILTRULE_PERISHABLE; + parse_filter_str(&filter_list, partial_dir, rule_template(rflags), 0); } @@ -315,7 +333,7 @@ void setup_protocol(int f_out,int f_in) if (am_server) { if (!checksum_seed) - checksum_seed = time(NULL); + checksum_seed = time(NULL) ^ (getpid() << 6); write_int(f_out, checksum_seed); } else { checksum_seed = read_int(f_in);