diff options
author | unknown <jimw@mysql.com> | 2005-10-25 10:10:53 -0700 |
---|---|---|
committer | unknown <jimw@mysql.com> | 2005-10-25 10:10:53 -0700 |
commit | b5dc243e3d7b8864cc8165856a9b47cca754e8d2 (patch) | |
tree | 741cd766a40e78f61813c3fec7e36efefe0ff12c /mysys/my_getopt.c | |
parent | 4a231e408cdbec3de2bb6cf8044cc435addc0fc8 (diff) | |
download | mariadb-git-b5dc243e3d7b8864cc8165856a9b47cca754e8d2.tar.gz |
Fix incorrect casts in my_getopt code that capped the maximum of longlong
options to the wrong value. (Bug #12925)
mysql-test/t/mysql_client_test.test:
Add parameter for testing getopt bug
mysys/my_getopt.c:
Remove incorrect and unnecessary casts
tests/mysql_client_test.c:
Add test case for Bug #12925 (my_getopt bug)
Diffstat (limited to 'mysys/my_getopt.c')
-rw-r--r-- | mysys/my_getopt.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/mysys/my_getopt.c b/mysys/my_getopt.c index 53e46932167..dfc3fb3d39c 100644 --- a/mysys/my_getopt.c +++ b/mysys/my_getopt.c @@ -689,10 +689,10 @@ static longlong getopt_ll(char *arg, const struct my_option *optp, int *err) ulonglong block_size= (optp->block_size ? (ulonglong) optp->block_size : 1L); num= eval_num_suffix(arg, err, (char*) optp->name); - if (num > 0 && (ulonglong) num > (ulonglong) (ulong) optp->max_value && + if (num > 0 && (ulonglong) num > (ulonglong) optp->max_value && optp->max_value) /* if max value is not set -> no upper limit */ - num= (longlong) (ulong) optp->max_value; - num= ((num - (longlong) optp->sub_size) / block_size); + num= (ulonglong) optp->max_value; + num= ((num - optp->sub_size) / block_size); num= (longlong) (num * block_size); return max(num, optp->min_value); } |