X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/5e2d51ee0675dc39d89c9ec11297a33c12b9181d..3696674bc62b0c1250027dbeedafdd7ebafdcf8b:/options.c diff --git a/options.c b/options.c index e7c6c612..5af0a319 100644 --- a/options.c +++ b/options.c @@ -1997,19 +1997,21 @@ int parse_arguments(int *argc_p, const char ***argv_p) return 0; } if (backup_dir) { + while (*backup_dir == '.' && backup_dir[1] == '/') + backup_dir += 2; + if (*backup_dir == '.' && backup_dir[1] == '\0') + 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; - if (backup_dir_remainder < 32) { + if (backup_dir_remainder < 128) { snprintf(err_buf, sizeof err_buf, "the --backup-dir path is WAY too long.\n"); return 0; } - if (backup_dir_buf[backup_dir_len - 1] != '/') { + if (backup_dir_len && backup_dir_buf[backup_dir_len - 1] != '/') { backup_dir_buf[backup_dir_len++] = '/'; backup_dir_buf[backup_dir_len] = '\0'; } - if (INFO_GTE(BACKUP, 1) && !am_sender) - rprintf(FINFO, "backup_dir is %s\n", backup_dir_buf); } else if (!backup_suffix_len && (!am_server || !am_sender)) { snprintf(err_buf, sizeof err_buf, "--suffix cannot be a null string without --backup-dir\n");