More backup improvements:
[rsync/rsync.git] / options.c
index e7c6c61..5af0a31 100644 (file)
--- 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");