Commit 5bf45c67 authored by Alexey Botchkov's avatar Alexey Botchkov

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.
parent 397ac7a4
......@@ -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);
......
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