summaryrefslogtreecommitdiff
path: root/mysys/my_getopt.c
diff options
context:
space:
mode:
authorunknown <knielsen@knielsen-hq.org>2009-09-11 15:20:03 +0200
committerunknown <knielsen@knielsen-hq.org>2009-09-11 15:20:03 +0200
commit829c6099b7e0a9eb689456db4160362d1e1c8011 (patch)
tree6ba803d2b34c2c76296781f94c054521d4e3407a /mysys/my_getopt.c
parent66a1902a01bcdc6ad42187339417a739847a4dd4 (diff)
downloadmariadb-git-829c6099b7e0a9eb689456db4160362d1e1c8011.tar.gz
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).
Diffstat (limited to 'mysys/my_getopt.c')
-rw-r--r--mysys/my_getopt.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c
index e57c1d71a13..ceb99975cdb 100644
--- a/mysys/my_getopt.c
+++ b/mysys/my_getopt.c
@@ -414,11 +414,17 @@ invalid value '%s'",
(optp->var_type & GET_TYPE_MASK) == GET_ENUM))
{
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
{
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
argument= optend;
}