./configure (optional if already run)
make
-based-on: 181c9faf928faad08ef095f4667afe460ec3bef6
+based-on: a01e3b490eb36ccf9e704840e1b6683dab867550
diff --git a/backup.c b/backup.c
--- a/backup.c
+++ b/backup.c
char *sockopts = NULL;
char *usermap = NULL;
char *groupmap = NULL;
-@@ -669,6 +675,8 @@ void usage(enum logcode F)
+@@ -670,6 +676,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);
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");
-@@ -968,7 +976,9 @@ static struct poptOption long_options[] = {
+@@ -969,7 +977,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 },
{"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 },
-@@ -1971,6 +1981,8 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -2006,6 +2016,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);
}
if (daemon_filter_list.head && !am_sender) {
filter_rule_list *elp = &daemon_filter_list;
-@@ -1992,6 +2004,14 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -2027,6 +2039,14 @@ int parse_arguments(int *argc_p, const char ***argv_p)
if (check_filter(elp, FLOG, dir, 1) < 0)
goto options_rejected;
}
}
if (!backup_suffix)
-@@ -2003,6 +2023,20 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -2038,6 +2058,20 @@ int parse_arguments(int *argc_p, const char ***argv_p)
backup_suffix);
return 0;
}
if (backup_dir) {
while (*backup_dir == '.' && backup_dir[1] == '/')
backup_dir += 2;
-@@ -2036,6 +2070,34 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -2071,6 +2105,34 @@ int parse_arguments(int *argc_p, const char ***argv_p)
"P *%s", backup_suffix);
parse_filter_str(&filter_list, backup_dir_buf, rule_template(0), 0);
}
if (make_backups && !backup_dir) {
omit_dir_times = 0; /* Implied, so avoid -O to sender. */
-@@ -2449,6 +2511,10 @@ void server_options(char **args, int *argc_p)
+@@ -2484,6 +2546,10 @@ void server_options(char **args, int *argc_p)
args[ac++] = "--backup-dir";
args[ac++] = backup_dir;
}
/* Only send --suffix if it specifies a non-default value. */
if (strcmp(backup_suffix, backup_dir ? "" : BACKUP_SUFFIX) != 0) {
-@@ -2457,7 +2523,14 @@ void server_options(char **args, int *argc_p)
+@@ -2492,7 +2558,14 @@ void server_options(char **args, int *argc_p)
goto oom;
args[ac++] = arg;
}