summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorGeorgi Kodinov <Georgi.Kodinov@Oracle.com>2010-08-03 19:01:30 +0300
committerGeorgi Kodinov <Georgi.Kodinov@Oracle.com>2010-08-03 19:01:30 +0300
commit5eeb6488cf3973c3821aef10d40ed221985f9190 (patch)
treeea6251ab5067de2f16859c5fba5e0da34d11b2f2 /mysys
parent60ab046abc82f75a174bf2ed19ef631a1a2e059a (diff)
downloadmariadb-git-5eeb6488cf3973c3821aef10d40ed221985f9190.tar.gz
Bug #42144: plugin_load fails
The enum system variables were handled inconsistently as ints, unsigned int and unsigned long on various places. This caused problems on platforms on which sizeof(int) != sizeof(long). Fixed by homogenizing the type of the enum variables to unsigned int, since it's size compatible with the C enum type. Removed the test from the experimental list.
Diffstat (limited to 'mysys')
-rw-r--r--mysys/my_getopt.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c
index b0e7175d0b9..6ed4189a69a 100644
--- a/mysys/my_getopt.c
+++ b/mysys/my_getopt.c
@@ -656,17 +656,21 @@ static int setval(const struct my_option *opts, void *value, char *argument,
return EXIT_OUT_OF_MEMORY;
break;
case GET_ENUM:
- if (((*(int*)result_pos)=
- find_type(argument, opts->typelib, 2) - 1) < 0)
{
- /*
- Accept an integer representation of the enumerated item.
- */
- char *endptr;
- unsigned int arg= (unsigned int) strtol(argument, &endptr, 10);
- if (*endptr || arg >= opts->typelib->count)
- return EXIT_ARGUMENT_INVALID;
- *(int*)result_pos= arg;
+ int type= find_type(argument, opts->typelib, 2);
+ if (type < 1)
+ {
+ /*
+ Accept an integer representation of the enumerated item.
+ */
+ char *endptr;
+ uint arg= (uint) strtoul(argument, &endptr, 10);
+ if (*endptr || arg >= opts->typelib->count)
+ return EXIT_ARGUMENT_INVALID;
+ *(uint*)result_pos= arg;
+ }
+ else
+ *(uint*)result_pos= type - 1;
}
break;
case GET_SET: