summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorunknown <msvensson@neptunus.(none)>2006-10-07 20:14:21 +0200
committerunknown <msvensson@neptunus.(none)>2006-10-07 20:14:21 +0200
commit13da57d0f15cf6a63c34010df530455da63bb2b0 (patch)
tree9115ad691fbdd57945a5e9873c2022b7b9ae3e34 /client
parent4f7097035f4f2ac4059dbbebdd6b4648b4e7b6e7 (diff)
downloadmariadb-git-13da57d0f15cf6a63c34010df530455da63bb2b0.tar.gz
Init "saved_expected_errors" at program start, avoids crash where --error is first command
strcmp -> strncmp
Diffstat (limited to 'client')
-rw-r--r--client/mysqltest.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/client/mysqltest.c b/client/mysqltest.c
index b89c763de13..3d457261980 100644
--- a/client/mysqltest.c
+++ b/client/mysqltest.c
@@ -2544,11 +2544,11 @@ void do_get_errcodes(struct st_command *command)
- May contain only digits[0-9] and _uppercase_ letters
*/
p++; /* Step past the S */
- if (end - p != SQLSTATE_LENGTH)
+ if ((end - p) != SQLSTATE_LENGTH)
die("The sqlstate must be exactly %d chars long", SQLSTATE_LENGTH);
/* Check sqlstate string validity */
- while (*p && p != end)
+ while (*p && p < end)
{
if (my_isdigit(charset_info, *p) || my_isupper(charset_info, *p))
*to_ptr++= *p++;
@@ -4652,7 +4652,8 @@ void handle_error(struct st_command *command,
*/
if (err_errno == CR_SERVER_LOST ||
err_errno == CR_SERVER_GONE_ERROR)
- die("require query '%s' failed: %d: %s", command->query, err_errno, err_error);
+ die("require query '%s' failed: %d: %s", command->query,
+ err_errno, err_error);
/* Abort the run of this test, pass the failed query as reason */
abort_not_supported_test("Query '%s' failed, required functionality" \
@@ -4669,8 +4670,8 @@ void handle_error(struct st_command *command,
if (((command->expected_errors.err[i].type == ERR_ERRNO) &&
(command->expected_errors.err[i].code.errnum == err_errno)) ||
((command->expected_errors.err[i].type == ERR_SQLSTATE) &&
- (strcmp(command->expected_errors.err[i].code.sqlstate,
- err_sqlstate) == 0)))
+ (strncmp(command->expected_errors.err[i].code.sqlstate,
+ err_sqlstate, SQLSTATE_LENGTH) == 0)))
{
if (!disable_result_log)
{
@@ -4695,7 +4696,7 @@ void handle_error(struct st_command *command,
}
DBUG_PRINT("info",("i: %d expected_errors: %d", i,
- command->expected_errors));
+ command->expected_errors.count));
if (!disable_result_log)
{
@@ -5423,6 +5424,9 @@ int main(int argc, char **argv)
save_file[0]= 0;
TMPDIR[0]= 0;
+ /* Init expected errors */
+ memset(&saved_expected_errors, 0, sizeof(saved_expected_errors));
+
/* Init connections */
memset(connections, 0, sizeof(connections));
connections_end= connections +