From 092ad77f47102a1342a68482713e41822a790b30 Mon Sep 17 00:00:00 2001 From: Haru Date: Sun, 22 Jan 2017 14:53:15 +0100 Subject: Fix CMDLINE_OPT_PARAM arguments in plugins failing to load When the server is called with a plugin-defined argument expecting additional values, in the form '--foo bar', the parser is unable to skip the additional value until the plugin is fully loaded. The issue was caused by the first scans of the argument list to find CMDLINE_OPT_PREINIT or CMDLINE_OPT_SILENT arguments, which happen before plugins are loaded, and would cause the parser to choke on the additional values, interpreting them as separate arguments. This is related to PR #1552, where we attempted to use this option for the first time. Signed-off-by: Haru --- src/common/core.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/common') diff --git a/src/common/core.c b/src/common/core.c index 74c63a6d6..9a131d042 100644 --- a/src/common/core.c +++ b/src/common/core.c @@ -404,6 +404,8 @@ int cmdline_exec(int argc, char **argv, unsigned int options) struct CmdlineArgData *data = NULL; const char *arg = argv[i]; if (arg[0] != '-') { // All arguments must begin with '-' + if ((options&(CMDLINE_OPT_SILENT|CMDLINE_OPT_PREINIT)) != 0) + continue; ShowError("Invalid option '%s'.\n", argv[i]); exit(EXIT_FAILURE); } -- cgit v1.2.3-70-g09d2