mirror of
https://github.com/RsyncProject/rsync.git
synced 2026-10-21 13:24:15 -04:00
Moved a couple auto-filter rules from options.c into compat.c so
that we are sure to only apply the perishable filter modifier when the receiving side is new enough to understand it.
This commit is contained in:
1 parent
27122338dc
commit
c12895089c
2 files changed
+22
-9
No files matched your search
@@ -43,7 +43,12 @@ extern int preserve_gid;
|
||||
extern int preserve_hard_links;
|
||||
extern int need_messages_from_generator;
|
||||
extern int delete_mode, delete_before, delete_during, delete_after;
|
||||
extern int delete_excluded;
|
||||
extern int make_backups;
|
||||
extern char *backup_dir, *backup_suffix;
|
||||
extern char *partial_dir;
|
||||
extern char *dest_option;
|
||||
extern struct filter_list_struct filter_list;
|
||||
|
||||
void setup_protocol(int f_out,int f_in)
|
||||
{
|
||||
@@ -150,6 +155,23 @@ void setup_protocol(int f_out,int f_in)
|
||||
need_messages_from_generator = 1;
|
||||
}
|
||||
|
||||
if (make_backups && !backup_dir && delete_mode && !delete_excluded
|
||||
&& !am_server) {
|
||||
char *rule;
|
||||
if (asprintf(&rule, "P%s *%s",
|
||||
!am_sender || protocol_version >= 30 ? "p" : "",
|
||||
backup_suffix) < 0)
|
||||
out_of_memory("setup_protocol");
|
||||
parse_rule(&filter_list, rule, 0, 0);
|
||||
free(rule);
|
||||
}
|
||||
if (partial_dir && *partial_dir != '/' && !am_server) {
|
||||
int flags = MATCHFLG_NO_PREFIXES | MATCHFLG_DIRECTORY;
|
||||
if (!am_sender || protocol_version >= 30)
|
||||
flags |= MATCHFLG_PERISHABLE;
|
||||
parse_rule(&filter_list, partial_dir, flags, 0);
|
||||
}
|
||||
|
||||
if (am_server) {
|
||||
if (!checksum_seed)
|
||||
checksum_seed = time(NULL);
|
||||
|
||||
@@ -1287,10 +1287,6 @@ int parse_arguments(int *argc, const char ***argv, int frommain)
|
||||
snprintf(err_buf, sizeof err_buf,
|
||||
"--suffix cannot be a null string without --backup-dir\n");
|
||||
return 0;
|
||||
} else if (make_backups && delete_mode && !delete_excluded) {
|
||||
snprintf(backup_dir_buf, sizeof backup_dir_buf,
|
||||
"Pp *%s", backup_suffix);
|
||||
parse_rule(&filter_list, backup_dir_buf, 0, 0);
|
||||
}
|
||||
if (make_backups && !backup_dir)
|
||||
omit_dir_times = 1;
|
||||
@@ -1403,11 +1399,6 @@ int parse_arguments(int *argc, const char ***argv, int frommain)
|
||||
clean_fname(partial_dir, 1);
|
||||
if (!*partial_dir || strcmp(partial_dir, ".") == 0)
|
||||
partial_dir = NULL;
|
||||
else if (*partial_dir != '/' && !am_server) {
|
||||
parse_rule(&filter_list, partial_dir,
|
||||
MATCHFLG_NO_PREFIXES | MATCHFLG_DIRECTORY
|
||||
| MATCHFLG_PERISHABLE, 0);
|
||||
}
|
||||
if (!partial_dir && refused_partial) {
|
||||
create_refuse_error(refused_partial);
|
||||
return 0;
|
||||
|
||||
Reference in new issue
Block a user