summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorAlexey Botchkov <holyfoot@mysql.com>2011-01-15 02:18:22 +0400
committerAlexey Botchkov <holyfoot@mysql.com>2011-01-15 02:18:22 +0400
commit5bf45c676f3365fa1b28a8014a8550ead982bfa2 (patch)
tree4a3d263de56eeb7d409d4cc4e77a95fc86f7db06 /mysys
parent397ac7a4c778098550bca91da48c08412d19115f (diff)
downloadmariadb-git-5bf45c676f3365fa1b28a8014a8550ead982bfa2.tar.gz
Bug#46393 If for slow_query_log a string is entered it does not complain.
For all the boolean system variables we now issue warnings if the value wasn't recognized. Before that we just silently set them to FALSE in this case. per-file comments: mysys/my_getopt.c Bug #46393 If for slow_query_log a string is entered it does not complain. warning issued if no documented value was specified.
Diffstat (limited to 'mysys')
-rw-r--r--mysys/my_getopt.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c
index 51c45ff1309..efa7e0bb1b3 100644
--- a/mysys/my_getopt.c
+++ b/mysys/my_getopt.c
@@ -611,13 +611,21 @@ static char *check_struct_option(char *cur_arg, char *key_name)
@param[in] argument The value argument
@return boolean value
*/
-static my_bool get_bool_argument(const char *argument)
+static my_bool get_bool_argument(const struct my_option *opts,
+ const char *argument)
{
if (!my_strcasecmp(&my_charset_latin1, argument, "true") ||
- !my_strcasecmp(&my_charset_latin1, argument, "on"))
+ !my_strcasecmp(&my_charset_latin1, argument, "on") ||
+ !my_strcasecmp(&my_charset_latin1, argument, "1"))
return 1;
- else
- return (my_bool) atoi(argument);
+ else if (!my_strcasecmp(&my_charset_latin1, argument, "false") ||
+ !my_strcasecmp(&my_charset_latin1, argument, "off") ||
+ !my_strcasecmp(&my_charset_latin1, argument, "0"))
+ return 0;
+ my_getopt_error_reporter(WARNING_LEVEL,
+ "option '%s': boolean value '%s' wasn't recognized. Set to OFF.",
+ opts->name, argument);
+ return 0;
}
/*
@@ -647,7 +655,7 @@ static int setval(const struct my_option *opts, void *value, char *argument,
switch ((opts->var_type & GET_TYPE_MASK)) {
case GET_BOOL: /* If argument differs from 0, enable option, else disable */
- *((my_bool*) value)= get_bool_argument(argument);
+ *((my_bool*) value)= get_bool_argument(opts, argument);
break;
case GET_INT:
*((int*) value)= (int) getopt_ll(argument, opts, &err);