Commit 6ec00a66 authored by unknown's avatar unknown

Fixed core dump bug in mysqltest

Added DBUG_ code to lib_vio.c


client/mysqltest.c:
  Fixed core dump bug
libmysqld/lib_vio.c:
  Added DBUG_ code
parent 31990c30
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
**********************************************************************/ **********************************************************************/
#define MTEST_VERSION "1.21" #define MTEST_VERSION "1.22"
#include <my_global.h> #include <my_global.h>
#include <mysql_embed.h> #include <mysql_embed.h>
...@@ -1451,7 +1451,7 @@ int do_connect(struct st_query* q) ...@@ -1451,7 +1451,7 @@ int do_connect(struct st_query* q)
if (!con_db[0]) if (!con_db[0])
con_db=db; con_db=db;
/* Special database to allow one to connect without a database name */ /* Special database to allow one to connect without a database name */
if (!strcmp(con_db,"*NO-ONE*")) if (con_db && !strcmp(con_db,"*NO-ONE*"))
con_db=0; con_db=0;
if ((con_error = safe_connect(&next_con->mysql, con_host, if ((con_error = safe_connect(&next_con->mysql, con_host,
con_user, con_pass, con_user, con_pass,
......
...@@ -61,15 +61,16 @@ struct st_vio ...@@ -61,15 +61,16 @@ struct st_vio
Vio *vio_new(my_socket sd, enum enum_vio_type type, my_bool localhost) Vio *vio_new(my_socket sd, enum enum_vio_type type, my_bool localhost)
{ {
Vio * vio = NULL; DBUG_ENTER("vio_new");
vio = (Vio *) my_malloc (sizeof(*vio),MYF(MY_WME|MY_ZEROFILL)); Vio * vio;
if (vio)
if ((vio= (Vio *) my_malloc(sizeof(*vio),MYF(MY_WME|MY_ZEROFILL))))
{ {
init_alloc_root(&vio->root, 8192, 8192); init_alloc_root(&vio->root, 8192, 8192);
vio->root.min_malloc = sizeof(char *) + 4; vio->root.min_malloc = sizeof(char *) + 4;
vio->last_packet = &vio->packets; vio->last_packet = &vio->packets;
} }
return (vio); DBUG_RETURN(vio);
} }
...@@ -84,19 +85,24 @@ Vio *vio_new_win32pipe(HANDLE hPipe) ...@@ -84,19 +85,24 @@ Vio *vio_new_win32pipe(HANDLE hPipe)
void vio_delete(Vio * vio) void vio_delete(Vio * vio)
{ {
DBUG_ENTER("vio_delete");
if (vio) if (vio)
{ {
if (vio->type != VIO_CLOSED) vio_close(vio); if (vio->type != VIO_CLOSED)
vio_close(vio);
free_root(&vio->root, MYF(0)); free_root(&vio->root, MYF(0));
my_free((gptr)vio, MYF(0)); my_free((gptr) vio, MYF(0));
} }
DBUG_VOID_RETURN;
} }
void vio_reset(Vio *vio) void vio_reset(Vio *vio)
{ {
DBUG_ENTER("vio_reset");
free_root(&vio->root, MYF(MY_KEEP_PREALLOC)); free_root(&vio->root, MYF(MY_KEEP_PREALLOC));
vio->packets = vio->where_in_packet = vio->end_of_packet = 0; vio->packets = vio->where_in_packet = vio->end_of_packet = 0;
vio->last_packet = &vio->packets; vio->last_packet = &vio->packets;
DBUG_VOID_RETURN;
} }
int vio_errno(Vio *vio __attribute__((unused))) int vio_errno(Vio *vio __attribute__((unused)))
...@@ -124,6 +130,7 @@ int vio_read(Vio * vio, gptr buf, int size) ...@@ -124,6 +130,7 @@ int vio_read(Vio * vio, gptr buf, int size)
int vio_write(Vio * vio, const gptr buf, int size) int vio_write(Vio * vio, const gptr buf, int size)
{ {
DBUG_ENTER("vio_write");
char *packet; char *packet;
if (vio->reading) if (vio->reading)
{ {
...@@ -141,7 +148,7 @@ int vio_write(Vio * vio, const gptr buf, int size) ...@@ -141,7 +148,7 @@ int vio_write(Vio * vio, const gptr buf, int size)
} }
else else
size= -1; size= -1;
return (size); DBUG_RETURN(size);
} }
int vio_blocking(Vio * vio, my_bool set_blocking_mode) int vio_blocking(Vio * vio, my_bool set_blocking_mode)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment