summaryrefslogtreecommitdiff
path: root/mysys/my_getopt.c
diff options
context:
space:
mode:
authorTatiana A. Nurnberg <azundris@mysql.com>2009-01-12 06:32:49 +0100
committerTatiana A. Nurnberg <azundris@mysql.com>2009-01-12 06:32:49 +0100
commita7d03bf4edbaff35f3d9447d7e3ad0c29fb7dd62 (patch)
tree684a2670babd0713bd47397b0ad741e352e2a113 /mysys/my_getopt.c
parentd58db1c2b01b9aafb7ae42219c5cfab05289bd1b (diff)
downloadmariadb-git-a7d03bf4edbaff35f3d9447d7e3ad0c29fb7dd62.tar.gz
Bug#31177: Server variables can't be set to their current values
Bounds-checks and blocksize corrections were applied to user-input, but constants in the server were trusted implicitly. If these values did not actually meet the requirements, the user could not set change a variable, then set it back to the (wonky) factory default or maximum by explicitly specifying it (SET <var>=<value> vs SET <var>=DEFAULT). Now checks also apply to the server's presets. Wonky values and maxima get corrected at startup. Consequently all non-offsetted values the user sees are valid, and users can set the variable to that exact value if they so desire.
Diffstat (limited to 'mysys/my_getopt.c')
-rw-r--r--mysys/my_getopt.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c
index 0f8055860d4..f97550d4429 100644
--- a/mysys/my_getopt.c
+++ b/mysys/my_getopt.c
@@ -976,24 +976,26 @@ static void init_one_value(const struct my_option *option, uchar* *variable,
*((my_bool*) variable)= (my_bool) value;
break;
case GET_INT:
- *((int*) variable)= (int) value;
+ *((int*) variable)= (int) getopt_ll_limit_value((int) value, option, NULL);
break;
- case GET_UINT:
case GET_ENUM:
*((uint*) variable)= (uint) value;
break;
+ case GET_UINT:
+ *((uint*) variable)= (uint) getopt_ull_limit_value((uint) value, option, NULL);
+ break;
case GET_LONG:
- *((long*) variable)= (long) value;
+ *((long*) variable)= (long) getopt_ll_limit_value((long) value, option, NULL);
break;
case GET_ULONG:
- *((ulong*) variable)= (ulong) value;
+ *((ulong*) variable)= (ulong) getopt_ull_limit_value((ulong) value, option, NULL);
break;
case GET_LL:
- *((longlong*) variable)= (longlong) value;
+ *((longlong*) variable)= (longlong) getopt_ll_limit_value((longlong) value, option, NULL);
break;
case GET_ULL:
case GET_SET:
- *((ulonglong*) variable)= (ulonglong) value;
+ *((ulonglong*) variable)= (ulonglong) getopt_ull_limit_value((ulonglong) value, option, NULL);
break;
case GET_DOUBLE:
*((double*) variable)= (double) value;