diff options
author | Alexey Botchkov <holyfoot@mysql.com> | 2011-01-15 02:18:22 +0400 |
---|---|---|
committer | Alexey Botchkov <holyfoot@mysql.com> | 2011-01-15 02:18:22 +0400 |
commit | 0e2211e927aab0b20eab14a504f20ad80d000243 (patch) | |
tree | 4a3d263de56eeb7d409d4cc4e77a95fc86f7db06 /mysys/my_getopt.c | |
parent | d027ad5193c011463970ee80af193372b84ab024 (diff) | |
download | mariadb-git-0e2211e927aab0b20eab14a504f20ad80d000243.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/my_getopt.c')
-rw-r--r-- | mysys/my_getopt.c | 18 |
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); |