diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/app/config/config.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/app/config/config.c b/src/app/config/config.c index 0c3b6a61a3..f946df7180 100644 --- a/src/app/config/config.c +++ b/src/app/config/config.c @@ -2601,8 +2601,11 @@ config_parse_commandline(int argc, char **argv, int ignore_errors) parsed_cmdline_free(result); return NULL; } - } else if (want_arg == ARGUMENT_OPTIONAL && is_last) { + } else if (want_arg == ARGUMENT_OPTIONAL && + /* optional arguments may never start with '-'. */ + (is_last || argv[i+1][0] == '-')) { arg = tor_strdup(""); + want_arg = ARGUMENT_NONE; // prevent skipping the next flag. } else { arg = (want_arg != ARGUMENT_NONE) ? tor_strdup(argv[i+1]) : tor_strdup(""); |