diff --git a/options.c b/options.c
--- a/options.c
+++ b/options.c
-@@ -162,10 +162,14 @@ int no_detach
+@@ -163,10 +163,14 @@ int no_detach
int write_batch = 0;
int read_batch = 0;
int backup_dir_len = 0;
char *tmpdir = NULL;
char *partial_dir = NULL;
char *basis_dir[MAX_BASIS_DIRS+1];
-@@ -178,7 +182,9 @@ char *password_file = NULL;
+@@ -179,7 +183,9 @@ char *password_file = NULL;
char *early_input_file = NULL;
char *rsync_path = RSYNC_PATH;
char *backup_dir = NULL;
char *sockopts = NULL;
char *usermap = NULL;
char *groupmap = NULL;
-@@ -774,7 +780,9 @@ static struct poptOption long_options[] = {
+@@ -776,7 +782,9 @@ static struct poptOption long_options[] = {
{"backup-deleted", 0, 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 },
-@@ -2224,6 +2232,8 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -2228,6 +2236,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;
-@@ -2245,6 +2255,14 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -2249,6 +2259,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)
-@@ -2256,6 +2274,20 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -2260,6 +2278,20 @@ int parse_arguments(int *argc_p, const char ***argv_p)
backup_suffix);
return 0;
}
if (backup_dir) {
size_t len;
make_backups = 1; /* --backup-dir implies --backup */
-@@ -2292,6 +2324,34 @@ int parse_arguments(int *argc_p, const char ***argv_p)
+@@ -2296,6 +2328,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 = -1; /* Implied, so avoid -O to sender. */
-@@ -2741,11 +2801,20 @@ void server_options(char **args, int *argc_p)
+@@ -2745,11 +2805,20 @@ void server_options(char **args, int *argc_p)
args[ac++] = "--backup-dir";
args[ac++] = safe_arg("", backup_dir);
}
diff --git a/rsync.1.md b/rsync.1.md
--- a/rsync.1.md
+++ b/rsync.1.md
-@@ -350,7 +350,9 @@ has its own detailed description later in this man page.
+@@ -350,7 +350,9 @@ has its own detailed description later in this manpage.
--backup, -b make backups (see --suffix & --backup-dir)
--backup-deleted make backups only of deleted files
--backup-dir=DIR make backups into hierarchy based in DIR
--update, -u skip files that are newer on the receiver
--inplace update destination files in-place
--append append data onto shorter files
-@@ -935,6 +937,11 @@ your home directory (remove the '=' for that).
+@@ -936,6 +938,11 @@ your home directory (remove the '=' for that).
daemon is the receiver, the backup dir cannot go outside the module's path
hierarchy, so take extra care not to delete it or copy into it.