Mention that --whole-file interferes with the reuse of a --partial-dir
[rsync/rsync.git] / options.c
index 805b9e1..a1c8df5 100644 (file)
--- a/options.c
+++ b/options.c
@@ -540,32 +540,28 @@ int parse_arguments(int *argc, const char ***argv, int frommain)
                        break;
 
                case OPT_EXCLUDE:
-                       if (am_server || sanitize_paths)
-                               return 0; /* Impossible... */
                        add_exclude(&exclude_list, poptGetOptArg(pc), 0);
                        break;
 
                case OPT_INCLUDE:
-                       if (am_server || sanitize_paths)
-                               return 0; /* Impossible... */
                        add_exclude(&exclude_list, poptGetOptArg(pc),
                                    XFLG_DEF_INCLUDE);
                        break;
 
                case OPT_EXCLUDE_FROM:
-                       if (am_server || sanitize_paths)
-                               return 0; /* Impossible... */
-                       arg = poptGetOptArg(pc);
-                       add_exclude_file(&exclude_list, arg,
-                                        XFLG_FATAL_ERRORS);
-                       break;
-
                case OPT_INCLUDE_FROM:
-                       if (am_server || sanitize_paths)
-                               return 0; /* Impossible... */
                        arg = poptGetOptArg(pc);
-                       add_exclude_file(&exclude_list, arg,
-                                        XFLG_FATAL_ERRORS | XFLG_DEF_INCLUDE);
+                       if (sanitize_paths)
+                               arg = sanitize_path(NULL, arg, NULL, 0);
+                       if (server_exclude_list.head) {
+                               char *cp = (char *)arg;
+                               clean_fname(cp, 1);
+                               if (check_exclude(&server_exclude_list, cp, 0) < 0)
+                                       goto options_rejected;
+                       }
+                       add_exclude_file(&exclude_list, arg, XFLG_FATAL_ERRORS
+                                        | (opt == OPT_INCLUDE_FROM
+                                         ? XFLG_DEF_INCLUDE : 0));
                        break;
 
                case 'h':
@@ -743,28 +739,28 @@ int parse_arguments(int *argc, const char ***argv, int frommain)
        if (server_exclude_list.head && !am_sender) {
                struct exclude_list_struct *elp = &server_exclude_list;
                if (tmpdir) {
-                       clean_fname(tmpdir);
+                       clean_fname(tmpdir, 1);
                        if (check_exclude(elp, tmpdir, 1) < 0)
                                goto options_rejected;
                }
                if (partial_dir) {
-                       clean_fname(partial_dir);
+                       clean_fname(partial_dir, 1);
                        if (check_exclude(elp, partial_dir, 1) < 0)
                                goto options_rejected;
                }
                if (compare_dest) {
-                       clean_fname(compare_dest);
+                       clean_fname(compare_dest, 1);
                        if (check_exclude(elp, compare_dest, 1) < 0)
                                goto options_rejected;
                }
                if (backup_dir) {
-                       clean_fname(backup_dir);
+                       clean_fname(backup_dir, 1);
                        if (check_exclude(elp, backup_dir, 1) < 0)
                                goto options_rejected;
                }
        }
        if (server_exclude_list.head && files_from) {
-               clean_fname(files_from);
+               clean_fname(files_from, 1);
                if (check_exclude(&server_exclude_list, files_from, 0) < 0) {
                    options_rejected:
                        snprintf(err_buf, sizeof err_buf,