summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2021-06-12 12:23:07 +0200
committerSergei Golubchik <serg@mariadb.org>2021-06-12 12:38:53 +0200
commit887f46a618ac2351dbf9f391f13aca9ba6fa9c54 (patch)
tree7ccec317a7d5e22a2daff1ce2887e9d7114736c8 /client
parent4352c77c5a3ac89acc5fd90a38f806d0ec500aa4 (diff)
downloadmariadb-git-887f46a618ac2351dbf9f391f13aca9ba6fa9c54.tar.gz
fix mysqltest crash report output
* read_command_buf is a pointer now, sizeof() no longer reflects its length, read_command_buflen is. * my_safe_print_str() prints multiple screens of '\0' bytes after the query end and up to read_command_buflen. Use fprintf() instead. * when setting connection->name to "-closed_connection-" update connection->name_len to match.
Diffstat (limited to 'client')
-rw-r--r--client/mysqltest.cc11
1 files changed, 7 insertions, 4 deletions
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index 2a9560e8903..1587d7513b3 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -90,6 +90,8 @@ static my_bool non_blocking_api_enabled= 0;
#define QUERY_PRINT_ORIGINAL_FLAG 4
+#define CLOSED_CONNECTION "-closed_connection-"
+
#ifndef HAVE_SETENV
static int setenv(const char *name, const char *value, int overwrite);
#endif
@@ -5569,11 +5571,12 @@ void do_close_connection(struct st_command *command)
my_free(con->name);
/*
- When the connection is closed set name to "-closed_connection-"
+ When the connection is closed set name to CLOSED_CONNECTION
to make it possible to reuse the connection name.
*/
- if (!(con->name = my_strdup("-closed_connection-", MYF(MY_WME))))
+ if (!(con->name = my_strdup(CLOSED_CONNECTION, MYF(MY_WME))))
die("Out of memory");
+ con->name_len= sizeof(CLOSED_CONNECTION)-1;
if (con == cur_con)
{
@@ -5957,7 +5960,7 @@ void do_connect(struct st_command *command)
con_slot= next_con;
else
{
- if (!(con_slot= find_connection_by_name("-closed_connection-")))
+ if (!(con_slot= find_connection_by_name(CLOSED_CONNECTION)))
die("Connection limit exhausted, you can have max %d connections",
opt_max_connections);
my_free(con_slot->name);
@@ -8980,7 +8983,7 @@ static void dump_backtrace(void)
struct st_connection *conn= cur_con;
fprintf(stderr, "read_command_buf (%p): ", read_command_buf);
- my_safe_print_str(read_command_buf, sizeof(read_command_buf));
+ fprintf(stderr, "%.*s\n", (int)read_command_buflen, read_command_buf);
fputc('\n', stderr);
if (conn)