Commit 829c6099 authored by unknown's avatar unknown

After-merge fix for MySQL 5.1.38 merge into MariaDB.

Due to a bugfix for enum options in MariaDB, my_getopt parses enums into an ulong.
However, some new code from MySQL was written to assume enums take an uint.

Fix by using the correct type.

(The new MySQL code in addition had an implicit assumption that my_bool and uint were
compatible; remove this assumption).
parent 66a1902a
...@@ -414,11 +414,17 @@ invalid value '%s'", ...@@ -414,11 +414,17 @@ invalid value '%s'",
(optp->var_type & GET_TYPE_MASK) == GET_ENUM)) (optp->var_type & GET_TYPE_MASK) == GET_ENUM))
{ {
if (optend == disabled_my_option) if (optend == disabled_my_option)
*((my_bool*) value)= (my_bool) 0; if ((optp->var_type & GET_TYPE_MASK) == GET_BOOL)
*((my_bool*) value)= (my_bool) 0;
else
*((ulong*) value)= (ulong) 0;
else else
{ {
if (!optend) /* No argument -> enable option */ if (!optend) /* No argument -> enable option */
*((my_bool*) value)= (my_bool) 1; if ((optp->var_type & GET_TYPE_MASK) == GET_BOOL)
*((my_bool*) value)= (my_bool) 1;
else
*((ulong*) value)= (ulong) 1;
else else
argument= optend; argument= optend;
} }
......
...@@ -2980,12 +2980,12 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp, ...@@ -2980,12 +2980,12 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp,
Allocate temporary space for the value of the tristate. Allocate temporary space for the value of the tristate.
This option will have a limited lifetime and is not used beyond This option will have a limited lifetime and is not used beyond
server initialization. server initialization.
GET_ENUM value is an integer. GET_ENUM value is an ulong.
*/ */
options[0].value= options[1].value= (uchar **)alloc_root(mem_root, options[0].value= options[1].value= (uchar **)alloc_root(mem_root,
sizeof(int)); sizeof(ulong));
*((uint*) options[0].value)= *((uint*) options[1].value)= *((ulong*) options[0].value)= *((ulong*) options[1].value)=
(uint) options[0].def_value; (ulong) options[0].def_value;
options+= 2; options+= 2;
...@@ -3269,7 +3269,7 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp, ...@@ -3269,7 +3269,7 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp,
Set plugin loading policy from option value. First element in the option Set plugin loading policy from option value. First element in the option
list is always the <plugin name> option value. list is always the <plugin name> option value.
*/ */
plugin_load_policy= (enum_plugin_load_policy)*(uint*)opts[0].value; plugin_load_policy= (enum_plugin_load_policy)*(ulong*)opts[0].value;
} }
disable_plugin= (plugin_load_policy == PLUGIN_OFF); disable_plugin= (plugin_load_policy == PLUGIN_OFF);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment