summaryrefslogtreecommitdiff
path: root/src/common/core.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2017-01-22 14:53:15 +0100
committerHaru <haru@dotalux.com>2017-01-22 15:06:41 +0100
commit092ad77f47102a1342a68482713e41822a790b30 (patch)
tree383bec20956dc7cc0906489ceff637dbef2ae3e5 /src/common/core.c
parent7d7b08b52250951da969e2680d10719a686dcd3c (diff)
downloadhercules-092ad77f47102a1342a68482713e41822a790b30.tar.gz
hercules-092ad77f47102a1342a68482713e41822a790b30.tar.bz2
hercules-092ad77f47102a1342a68482713e41822a790b30.tar.xz
hercules-092ad77f47102a1342a68482713e41822a790b30.zip
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 <haru@dotalux.com>
Diffstat (limited to 'src/common/core.c')
-rw-r--r--src/common/core.c2
1 files changed, 2 insertions, 0 deletions
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);
}