diff options
author | Wayne Davison <wayne@opencoder.net> | 2022-10-02 09:42:17 -0700 |
---|---|---|
committer | Wayne Davison <wayne@opencoder.net> | 2022-10-02 09:54:59 -0700 |
commit | 25efa10802dd416529d5dbaaac20a485db1f33b2 (patch) | |
tree | 48695a04423212834e741a09c0651a91680d3445 | |
parent | fdf5e577f59cf709eb3559137ce3be1431522d07 (diff) | |
download | rsync-25efa10802dd416529d5dbaaac20a485db1f33b2.tar.gz |
Complain if the destination arg is empty.
-rw-r--r-- | main.c | 15 |
1 files changed, 13 insertions, 2 deletions
@@ -660,6 +660,16 @@ static pid_t do_cmd(char *cmd, char *machine, char *user, char **remote_argv, in return pid; } +/* Older versions turn an empty string as a reference to the current directory. + * We now treat this as an error unless --old-args was used. */ +static char *dot_dir_or_error() +{ + if (old_style_args || am_server) + return "."; + rprintf(FERROR, "Empty destination arg specified (use \".\" or see --old-args).\n"); + exit_cleanup(RERR_SYNTAX); +} + /* The receiving side operates in one of two modes: * * 1. it receives any number of files into a destination directory, @@ -687,9 +697,8 @@ static char *get_local_name(struct file_list *flist, char *dest_path) if (!dest_path || list_only) return NULL; - /* Treat an empty string as a copy into the current directory. */ if (!*dest_path) - dest_path = "."; + dest_path = dot_dir_or_error(); if (daemon_filter_list.head) { char *slash = strrchr(dest_path, '/'); @@ -1432,6 +1441,8 @@ static int start_client(int argc, char *argv[]) if (argc > 1) { p = argv[--argc]; + if (!*p) + p = dot_dir_or_error(); remote_argv = argv + argc; } else { static char *dotarg[1] = { "." }; |