Tweaked some variable names in readlink_stat() and link_stat().
[rsync/rsync.git] / options.c
index c6d062a..a80da6a 100644 (file)
--- a/options.c
+++ b/options.c
@@ -893,12 +893,15 @@ int parse_arguments(int *argc, const char ***argv, int frommain)
                        if (sanitize_paths)
                                arg = sanitize_path(NULL, arg, NULL, 0);
                        if (server_filter_list.head) {
-                               char *cp = (char *)arg;
+                               char *cp = strdup(arg);
+                               if (!cp)
+                                       out_of_memory("parse_arguments");
                                if (!*cp)
                                        goto options_rejected;
                                clean_fname(cp, 1);
                                if (check_filter(&server_filter_list, cp, 0) < 0)
                                        goto options_rejected;
+                               free(cp);
                        }
                        parse_filter_file(&filter_list, arg,
                                opt == OPT_INCLUDE_FROM ? MATCHFLG_INCLUDE : 0,
@@ -1048,10 +1051,9 @@ int parse_arguments(int *argc, const char ***argv, int frommain)
                                        MAX_BASIS_DIRS, dest_option);
                                return 0;
                        }
-                       arg = poptGetOptArg(pc);
-                       if (sanitize_paths)
-                               arg = sanitize_path(NULL, arg, NULL, 0);
-                       basis_dir[basis_dir_cnt++] = (char *)arg;
+                       /* We defer sanitizing this arg until we know what
+                        * our destination directory is going to be. */
+                       basis_dir[basis_dir_cnt++] = (char *)poptGetOptArg(pc);
                        break;
 
                case OPT_CHMOD:
@@ -1216,7 +1218,6 @@ int parse_arguments(int *argc, const char ***argv, int frommain)
        }
        if (server_filter_list.head && !am_sender) {
                struct filter_list_struct *elp = &server_filter_list;
-               int i;
                if (tmpdir) {
                        if (!*tmpdir)
                                goto options_rejected;
@@ -1229,13 +1230,6 @@ int parse_arguments(int *argc, const char ***argv, int frommain)
                        if (check_filter(elp, partial_dir, 1) < 0)
                                goto options_rejected;
                }
-               for (i = 0; i < basis_dir_cnt; i++) {
-                       if (!*basis_dir[i])
-                               goto options_rejected;
-                       clean_fname(basis_dir[i], 1);
-                       if (check_filter(elp, basis_dir[i], 1) < 0)
-                               goto options_rejected;
-               }
                if (backup_dir) {
                        if (!*backup_dir)
                                goto options_rejected;