X-Git-Url: https://mattmccutchen.net/rsync/rsync-patches.git/blobdiff_plain/bc3fcf1d39ca698386e09f1abc1a54178102e558..0ef5abcbbb95298fa9faf1d3eb275a9e76e1d951:/backup-dir-dels.diff diff --git a/backup-dir-dels.diff b/backup-dir-dels.diff index 82b6adc..3919e07 100644 --- a/backup-dir-dels.diff +++ b/backup-dir-dels.diff @@ -79,7 +79,7 @@ diff --git a/backup.c b/backup.c stat_x sx; while (*fullpath == '.' && fullpath[1] == '/') { -@@ -211,7 +235,8 @@ static int keep_backup(const char *fname) +@@ -221,7 +245,8 @@ static int keep_backup(const char *fname) if (!(file = make_file(fname, NULL, NULL, 0, NO_FILTERS))) return 1; /* the file could have disappeared */ @@ -89,7 +89,7 @@ diff --git a/backup.c b/backup.c unmake_file(file); return 0; } -@@ -322,7 +347,17 @@ static int keep_backup(const char *fname) +@@ -356,7 +381,17 @@ static int keep_backup(const char *fname) /* main backup switch routine */ int make_backup(const char *fname) { @@ -157,7 +157,7 @@ diff --git a/options.c b/options.c int write_batch = 0; int read_batch = 0; int backup_dir_len = 0; -+int backup_dir_dels_len = 0; ++int backup_dir_dels_len = 0; int backup_suffix_len; +int backup_suffix_dels_len; unsigned int backup_dir_remainder; @@ -178,7 +178,7 @@ diff --git a/options.c b/options.c char *sockopts = NULL; int rsync_port = 0; int compare_dest = 0; -@@ -325,6 +331,8 @@ void usage(enum logcode F) +@@ -326,6 +332,8 @@ void usage(enum logcode F) rprintf(F," -b, --backup make backups (see --suffix & --backup-dir)\n"); rprintf(F," --backup-dir=DIR make backups into hierarchy based in DIR\n"); rprintf(F," --suffix=SUFFIX set backup suffix (default %s w/o --backup-dir)\n",BACKUP_SUFFIX); @@ -187,7 +187,7 @@ diff --git a/options.c b/options.c rprintf(F," -u, --update skip files that are newer on the receiver\n"); rprintf(F," --inplace update destination files in-place (SEE MAN PAGE)\n"); rprintf(F," --append append data onto shorter files\n"); -@@ -609,7 +617,9 @@ static struct poptOption long_options[] = { +@@ -610,7 +618,9 @@ static struct poptOption long_options[] = { {"backup", 'b', POPT_ARG_VAL, &make_backups, 1, 0, 0 }, {"no-backup", 0, POPT_ARG_VAL, &make_backups, 0, 0, 0 }, {"backup-dir", 0, POPT_ARG_STRING, &backup_dir, 0, 0, 0 }, @@ -197,7 +197,7 @@ diff --git a/options.c b/options.c {"list-only", 0, POPT_ARG_VAL, &list_only, 2, 0, 0 }, {"read-batch", 0, POPT_ARG_STRING, &batch_name, OPT_READ_BATCH, 0, 0 }, {"write-batch", 0, POPT_ARG_STRING, &batch_name, OPT_WRITE_BATCH, 0, 0 }, -@@ -1453,6 +1463,8 @@ int parse_arguments(int *argc_p, const char ***argv_p) +@@ -1454,6 +1464,8 @@ int parse_arguments(int *argc_p, const char ***argv_p) tmpdir = sanitize_path(NULL, tmpdir, NULL, 0, SP_DEFAULT); if (backup_dir) backup_dir = sanitize_path(NULL, backup_dir, NULL, 0, SP_DEFAULT); @@ -206,7 +206,7 @@ diff --git a/options.c b/options.c } if (daemon_filter_list.head && !am_sender) { struct filter_list_struct *elp = &daemon_filter_list; -@@ -1474,6 +1486,14 @@ int parse_arguments(int *argc_p, const char ***argv_p) +@@ -1475,6 +1487,14 @@ int parse_arguments(int *argc_p, const char ***argv_p) if (check_filter(elp, FLOG, dir, 1) < 0) goto options_rejected; } @@ -221,7 +221,7 @@ diff --git a/options.c b/options.c } if (!backup_suffix) -@@ -1485,6 +1505,20 @@ int parse_arguments(int *argc_p, const char ***argv_p) +@@ -1486,6 +1506,20 @@ int parse_arguments(int *argc_p, const char ***argv_p) backup_suffix); return 0; } @@ -236,13 +236,13 @@ diff --git a/options.c b/options.c + if (strchr(backup_suffix_dels, '/') != NULL) { + snprintf(err_buf, sizeof err_buf, + "--suffix-dels cannot contain slashes: %s\n", -+ backup_suffix_dels); ++ backup_suffix_dels); + return 0; + } if (backup_dir) { backup_dir_len = strlcpy(backup_dir_buf, backup_dir, sizeof backup_dir_buf); backup_dir_remainder = sizeof backup_dir_buf - backup_dir_len; -@@ -1508,6 +1542,34 @@ int parse_arguments(int *argc_p, const char ***argv_p) +@@ -1509,6 +1543,34 @@ int parse_arguments(int *argc_p, const char ***argv_p) "P *%s", backup_suffix); parse_rule(&filter_list, backup_dir_buf, 0, 0); } @@ -277,7 +277,7 @@ diff --git a/options.c b/options.c if (make_backups && !backup_dir) { omit_dir_times = 0; /* Implied, so avoid -O to sender. */ -@@ -1901,6 +1963,10 @@ void server_options(char **args, int *argc_p) +@@ -1917,6 +1979,10 @@ void server_options(char **args, int *argc_p) args[ac++] = "--backup-dir"; args[ac++] = backup_dir; } @@ -288,7 +288,7 @@ diff --git a/options.c b/options.c /* Only send --suffix if it specifies a non-default value. */ if (strcmp(backup_suffix, backup_dir ? "" : BACKUP_SUFFIX) != 0) { -@@ -1909,7 +1975,14 @@ void server_options(char **args, int *argc_p) +@@ -1925,7 +1991,14 @@ void server_options(char **args, int *argc_p) goto oom; args[ac++] = arg; }