summaryrefslogtreecommitdiff
path: root/libmysqld
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2022-11-24 21:51:19 +0100
committerSergei Golubchik <serg@mariadb.org>2022-12-02 16:19:13 +0100
commitc7c1461b9454606eb67020a57de658c6df21730a (patch)
tree9cb469c28d04da50d7fc6d54530c1d747d09cecf /libmysqld
parentcfb47ddde2bbbdc3065ed2b959bd4719247fbd30 (diff)
downloadmariadb-git-c7c1461b9454606eb67020a57de658c6df21730a.tar.gz
fix embedded startup with no command line arguments
&fake_argv cannot be cast to char*** this causes a crash when resolving
Diffstat (limited to 'libmysqld')
-rw-r--r--libmysqld/lib_sql.cc15
1 files changed, 6 insertions, 9 deletions
diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc
index a2afcabe073..3ef9ad98e0e 100644
--- a/libmysqld/lib_sql.cc
+++ b/libmysqld/lib_sql.cc
@@ -518,7 +518,6 @@ int init_embedded_server(int argc, char **argv, char **groups)
*/
int *argcp;
char ***argvp;
- int fake_argc = 1;
char *fake_argv[] = { (char *)"", 0 };
const char *fake_groups[] = { "server", "embedded", 0 };
my_bool acl_error;
@@ -531,16 +530,14 @@ int init_embedded_server(int argc, char **argv, char **groups)
if (init_early_variables())
return 1;
- if (argc)
+ if (!argc)
{
- argcp= &argc;
- argvp= (char***) &argv;
- }
- else
- {
- argcp= &fake_argc;
- argvp= (char ***) &fake_argv;
+ argc= 1;
+ argv= fake_argv;
}
+ argcp= &argc;
+ argvp= &argv;
+
if (!groups)
groups= (char**) fake_groups;