Configure check for -Wno-unused-parameter now tries to link too.
[rsync/rsync.git] / options.c
index b307adf..580f86f 100644 (file)
--- a/options.c
+++ b/options.c
@@ -93,7 +93,7 @@ char *files_from = NULL;
 int filesfrom_fd = -1;
 char *filesfrom_host = NULL;
 int eol_nulls = 0;
-int protect_args = 0;
+int protect_args = -1;
 int human_readable = 1;
 int recurse = 0;
 int allow_inc_recurse = 1;
@@ -271,7 +271,7 @@ static struct output_struct debug_words[COUNT_DEBUG+1] = {
        DEBUG_WORD(DEL, W_REC, "Debug delete actions (levels 1-3)"),
        DEBUG_WORD(DELTASUM, W_SND|W_REC, "Debug delta-transfer checksumming (levels 1-4)"),
        DEBUG_WORD(DUP, W_REC, "Debug weeding of duplicate names"),
-       DEBUG_WORD(EXIT, W_CLI|W_SRV, "Debug exit events (levels 1-2)"),
+       DEBUG_WORD(EXIT, W_CLI|W_SRV, "Debug exit events (levels 1-3)"),
        DEBUG_WORD(FILTER, W_SND|W_REC, "Debug filter actions (levels 1-2)"),
        DEBUG_WORD(FLIST, W_SND|W_REC, "Debug file-list operations (levels 1-4)"),
        DEBUG_WORD(FUZZY, W_REC, "Debug fuzzy scoring (levels 1-2)"),
@@ -1278,7 +1278,7 @@ int parse_arguments(int *argc_p, const char ***argv_p)
        }
 
 #ifdef ICONV_OPTION
-       if (!am_daemon && !protect_args && (arg = getenv("RSYNC_ICONV")) != NULL && *arg)
+       if (!am_daemon && protect_args <= 0 && (arg = getenv("RSYNC_ICONV")) != NULL && *arg)
                iconv_opt = strdup(arg);
 #endif
 
@@ -1333,6 +1333,7 @@ int parse_arguments(int *argc_p, const char ***argv_p)
 #ifdef ICONV_OPTION
                        iconv_opt = NULL;
 #endif
+                       protect_args = 0;
                        poptFreeContext(pc);
                        pc = poptGetContext(RSYNC_NAME, argc, argv,
                                            long_daemon_options, 0);
@@ -1778,6 +1779,20 @@ int parse_arguments(int *argc_p, const char ***argv_p)
                }
        }
 
+       if (protect_args < 0) {
+               if (am_server)
+                       protect_args = 0;
+               else if ((arg = getenv("RSYNC_PROTECT_ARGS")) != NULL && *arg)
+                       protect_args = atoi(arg) ? 1 : 0;
+               else {
+#ifdef RSYNC_USE_PROTECTED_ARGS
+                       protect_args = 1;
+#else
+                       protect_args = 0;
+#endif
+               }
+       }
+
        if (human_readable > 1 && argc == 2 && !am_server) {
                /* Allow the old meaning of 'h' (--help) on its own. */
                usage(FINFO);