Complain about --old-args with --protect-args.
authorWayne Davison <wayne@opencoder.net>
Tue, 18 Jan 2022 01:11:58 +0000 (17:11 -0800)
committerWayne Davison <wayne@opencoder.net>
Tue, 18 Jan 2022 02:09:36 +0000 (18:09 -0800)
options.c

index 0a7b4cc799db7ef85ab0942c513a824754dcd287..d08f00038fa482d217201ae44d5a7fbf532ea0cc 100644 (file)
--- a/options.c
+++ b/options.c
@@ -1933,10 +1933,18 @@ int parse_arguments(int *argc_p, const char ***argv_p)
        }
 
        if (old_style_args < 0) {
-               if (!am_server && (arg = getenv("RSYNC_OLD_ARGS")) != NULL && *arg)
+               if (!am_server && protect_args <= 0 && (arg = getenv("RSYNC_OLD_ARGS")) != NULL && *arg) {
+                       protect_args = 0;
                        old_style_args = atoi(arg);
-               else
+               else
                        old_style_args = 0;
+       } else if (old_style_args) {
+               if (protect_args > 0) {
+                       snprintf(err_buf, sizeof err_buf,
+                                "--protect-args conflicts with --old-args.\n");
+                       return 0;
+               }
+               protect_args = 0;
        }
 
        if (protect_args < 0) {