summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorunknown <jimw@mysql.com>2006-04-21 19:29:22 -0700
committerunknown <jimw@mysql.com>2006-04-21 19:29:22 -0700
commit8057e30909d8433ca102bd31d3ba855cc3441043 (patch)
treea4abb12e68d3a6d2399b857dc1af6a72132e3eb4 /client
parenta52bd573de515c2c0f4c40311f4201e183275713 (diff)
downloadmariadb-git-8057e30909d8433ca102bd31d3ba855cc3441043.tar.gz
Bug #18495: mysqltest does not use the correct error number
When looking up the error number for named errors in mysqltest .test files, we inadvertantly would match ER_WRONG_VALUE against ER_WRONG_VALUE_COUNT because we were using the length of the shorter string in strncmp(). Now we double-check the length of matches to make sure it was a complete match. client/mysqltest.c: Check the length of the error name to make sure it wasn't just a partial match mysql-test/t/events.test: Replace error numbers with error names, with side-effect of testing Bug #18495.
Diffstat (limited to 'client')
-rw-r--r--client/mysqltest.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/client/mysqltest.c b/client/mysqltest.c
index cfd69e45ba7..b630de8be4e 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -1956,7 +1956,13 @@ static uint get_errcodes(match_err *to,struct st_query *q)
;
for (; e->name; e++)
{
- if (!strncmp(start, e->name, (int) (p - start)))
+ /*
+ If we get a match, we need to check the length of the name we
+ matched against in case it was longer than what we are checking
+ (as in ER_WRONG_VALUE vs. ER_WRONG_VALUE_COUNT).
+ */
+ if (!strncmp(start, e->name, (int) (p - start)) &&
+ strlen(e->name) == (p - start))
{
to[count].code.errnum= (uint) e->code;
to[count].type= ERR_ERRNO;