1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

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.
This commit is contained in:
Alexey Botchkov
2011-01-15 02:18:22 +04:00
parent 397ac7a4c7
commit 5bf45c676f

View File

@@ -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);