X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/d175d7e13edad3c9676351160553de4957e5dfbc..191e40da17f9139cb702c48a7d708a4563ccc0c2:/options.c diff --git a/options.c b/options.c index 945dddd2..2dd0da44 100644 --- a/options.c +++ b/options.c @@ -633,6 +633,11 @@ int parse_arguments(int *argc, const char ***argv, int frommain) if (!backup_suffix) backup_suffix = backup_dir? "" : BACKUP_SUFFIX; backup_suffix_len = strlen(backup_suffix); + if (strchr(backup_suffix, '/') != NULL) { + rprintf(FERROR, "--suffix cannot contain slashes: %s\n", + backup_suffix); + exit_cleanup(RERR_SYNTAX); + } if (backup_dir) backup_dir_len = strlen(backup_dir); else if (!backup_suffix_len) { @@ -821,8 +826,12 @@ void server_options(char **args,int *argc) /* Only send --suffix if it specifies a non-default value. */ if (strcmp(backup_suffix, backup_dir? "" : BACKUP_SUFFIX) != 0) { - args[ac++] = "--suffix"; - args[ac++] = backup_suffix; + char *s = malloc(9+backup_suffix_len+1); + if (!s) + out_of_memory("server_options"); + /* We use the following syntax to avoid weirdness with '~'. */ + sprintf(s, "--suffix=%s", backup_suffix); + args[ac++] = s; } if (delete_mode && !delete_excluded)