+ if (read_batch)
+ check_batch_flags();
+
+ if (protocol_version < 30) {
+ if (append_mode == 1)
+ append_mode = 2;
+ if (preserve_acls && !local_server) {
+ rprintf(FERROR,
+ "--acls requires protocol 30 or higher"
+ " (negotiated %d).\n",
+ protocol_version);
+ exit_cleanup(RERR_PROTOCOL);
+ }
+ if (preserve_xattrs && !local_server) {
+ rprintf(FERROR,
+ "--xattrs requires protocol 30 or higher"
+ " (negotiated %d).\n",
+ protocol_version);
+ exit_cleanup(RERR_PROTOCOL);
+ }
+ }
+
+ if (delete_mode && !(delete_before+delete_during+delete_after)) {
+ if (protocol_version < 30)
+ delete_before = 1;
+ else
+ delete_during = 1;
+ }
+
+ if (protocol_version < 29) {
+ if (fuzzy_basis) {
+ rprintf(FERROR,
+ "--fuzzy requires protocol 29 or higher"
+ " (negotiated %d).\n",
+ protocol_version);
+ exit_cleanup(RERR_PROTOCOL);
+ }
+
+ if (basis_dir_cnt && inplace) {
+ rprintf(FERROR,
+ "%s with --inplace requires protocol 29 or higher"
+ " (negotiated %d).\n",
+ dest_option, protocol_version);
+ exit_cleanup(RERR_PROTOCOL);
+ }
+
+ if (basis_dir_cnt > 1) {
+ rprintf(FERROR,
+ "Using more than one %s option requires protocol"
+ " 29 or higher (negotiated %d).\n",
+ dest_option, protocol_version);
+ exit_cleanup(RERR_PROTOCOL);
+ }
+
+ if (prune_empty_dirs) {
+ rprintf(FERROR,
+ "--prune-empty-dirs requires protocol 29 or higher"
+ " (negotiated %d).\n",
+ protocol_version);
+ exit_cleanup(RERR_PROTOCOL);
+ }
+ } else if (protocol_version >= 30) {
+ if (am_server) {
+ compat_flags = allow_inc_recurse ? CF_INC_RECURSE : 0;
+#ifdef CAN_SET_SYMLINK_TIMES
+ compat_flags |= CF_SYMLINK_TIMES;
+#endif
+#ifdef ICONV_OPTION
+ compat_flags |= CF_SYMLINK_ICONV;
+#endif
+ if (local_server || strchr(client_info, 'f') != NULL)
+ compat_flags |= CF_SAFE_FLIST;
+ 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;
+ if (am_sender) {
+ receiver_symlink_times = am_server
+ ? strchr(client_info, 'L') != NULL
+ : !!(compat_flags & CF_SYMLINK_TIMES);
+ }
+#ifdef CAN_SET_SYMLINK_TIMES
+ else
+ receiver_symlink_times = 1;
+#endif
+#ifdef ICONV_OPTION
+ sender_symlink_iconv = iconv_opt && (am_server
+ ? local_server || strchr(client_info, 's') != NULL
+ : !!(compat_flags & CF_SYMLINK_ICONV));
+#endif
+ if (inc_recurse && !allow_inc_recurse) {
+ /* This should only be able to happen in a batch. */
+ fprintf(stderr,
+ "Incompatible options specified for inc-recursive %s.\n",
+ read_batch ? "batch file" : "connection");
+ exit_cleanup(RERR_SYNTAX);
+ }
+ 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) {
+ receiver_symlink_times = 1;
+#endif
+ }
+
+ if (need_unsorted_flist && (!am_sender || inc_recurse))
+ unsort_ndx = ++file_extra_cnt;
+
+ if (partial_dir && *partial_dir != '/' && (!am_server || local_server)) {
+ int rflags = FILTRULE_NO_PREFIXES | FILTRULE_DIRECTORY;
+ if (!am_sender || protocol_version >= 30)
+ rflags |= FILTRULE_PERISHABLE;
+ parse_filter_str(&filter_list, partial_dir, rule_template(rflags), 0);
+ }
+
+
+#ifdef ICONV_OPTION
+ if (protect_args && files_from) {
+ if (am_sender)
+ filesfrom_convert = filesfrom_host && ic_send != (iconv_t)-1;
+ else
+ filesfrom_convert = !filesfrom_host && ic_recv != (iconv_t)-1;
+ }
+#endif