List:General Discussion« Previous MessageNext Message »
From:Michael Widenius Date:September 26 1999 11:10pm
Subject:mysql_close() hang
View as plain text  
>>>>> "TOMITA" == TOMITA Masahiro <tommy@stripped> writes:

>> Description:
TOMITA> 	mysql_close() hang if not calling mysql_real_connect().
>> How-To-Repeat:
TOMITA> 	% cat aa.c
TOMITA> 	#include <mysql.h>
TOMITA> 	#define NULL 0
TOMITA> 	main()
TOMITA> 	{
TOMITA> 	  MYSQL m;
TOMITA> 	  mysql_init(&m);
TOMITA> 	  mysql_close(&m);
TOMITA> 	}
TOMITA> 	% gcc aa.c -I /usr/local/include/mysql/ -L /usr/local/lib/mysql -lmysqlclient
TOMITA> 	% ./a.out
TOMITA> 	<hang...>

>> Fix:

TOMITA> *** client/libmysql.c.orig	Wed Sep  8 23:47:38 1999
TOMITA> --- client/libmysql.c	Mon Sep 27 05:18:15 1999
TOMITA> ***************
TOMITA> *** 908,915 ****
TOMITA>         return 0;
mysql-> free_me=1;
TOMITA> -     mysql->net.fd= INVALID_SOCKET;
TOMITA>     }
TOMITA>     else
TOMITA>       bzero((char*) (mysql),sizeof(*(mysql)));
TOMITA>   #ifdef __WIN32__
mysql-> options.connect_timeout=20;
TOMITA> --- 908,915 ----
TOMITA>         return 0;
mysql-> free_me=1;
TOMITA>     }
TOMITA>     else
TOMITA>       bzero((char*) (mysql),sizeof(*(mysql)));
TOMITA> +   mysql->net.fd= INVALID_SOCKET;
TOMITA>   #ifdef __WIN32__
mysql-> options.connect_timeout=20;


Applied; Thanks!

Regards,
Monty
Thread
mysql_close() hangTOMITA Masahiro26 Sep
  • mysql_close() hangMichael Widenius27 Sep