From d2b95cd7ab5b3ed450af572e9c77cd11d3c420ba Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 16 May 2002 16:32:51 +0300 Subject: New my_gethostbyname_r() handling Changed some status variable names Fix bug in GRANT ... PASSWORD string Docs/manual.texi: Update of variable names include/my_net.h: New my_gethostbyname_r() handling include/my_pthread.h: New my_gethostbyname_r() handling libmysql/Makefile.shared: New my_gethostbyname_r() handling libmysql/libmysql.c: New my_gethostbyname_r() handling mysys/Makefile.am: New my_gethostbyname_r() handling mysys/my_pthread.c: New my_gethostbyname_r() handling mysys/my_thr_init.c: New my_gethostbyname_r() handling sql/hostname.cc: New my_gethostbyname_r() handling sql/mini_client.cc: New my_gethostbyname_r() handling sql/mysqld.cc: change some status variable names sql/sql_acl.cc: Fix bug in GRANT ... PASSWORD string --- libmysql/Makefile.shared | 2 +- libmysql/libmysql.c | 15 ++------------- 2 files changed, 3 insertions(+), 14 deletions(-) (limited to 'libmysql') diff --git a/libmysql/Makefile.shared b/libmysql/Makefile.shared index e9e100e38b1..76d37c149c9 100644 --- a/libmysql/Makefile.shared +++ b/libmysql/Makefile.shared @@ -56,7 +56,7 @@ mysysobjects1 = my_init.lo my_static.lo my_malloc.lo my_realloc.lo \ thr_mutex.lo mulalloc.lo string.lo default.lo \ my_compress.lo array.lo my_once.lo list.lo my_net.lo \ charset.lo hash.lo mf_iocache.lo my_seek.lo \ - my_pread.lo mf_cache.lo + my_pread.lo mf_cache.lo my_gethostbyname.lo # Not needed in the minimum library mysysobjects2 = getopt.lo getopt1.lo getvar.lo my_lib.lo mysysobjects = $(mysysobjects1) $(mysysobjects2) diff --git a/libmysql/libmysql.c b/libmysql/libmysql.c index ffce5f6bce7..4190a4c37f4 100644 --- a/libmysql/libmysql.c +++ b/libmysql/libmysql.c @@ -1312,7 +1312,6 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, memcpy_fixed(&sock_addr.sin_addr,&ip_addr,sizeof(ip_addr)); } else -#if defined(HAVE_GETHOSTBYNAME_R) && defined(_REENTRANT) && defined(THREAD) { int tmp_errno; struct hostent tmp_hostent,*hp; @@ -1323,22 +1322,12 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user, { net->last_errno=CR_UNKNOWN_HOST; sprintf(net->last_error, ER(CR_UNKNOWN_HOST), host, tmp_errno); + my_gethostbyname_r_free(); goto error; } memcpy(&sock_addr.sin_addr,hp->h_addr, (size_t) hp->h_length); + my_gethostbyname_r_free(); } -#else - { - struct hostent *hp; - if (!(hp=gethostbyname(host))) - { - net->last_errno=CR_UNKNOWN_HOST; - sprintf(net->last_error, ER(CR_UNKNOWN_HOST), host, socket_errno); - goto error; - } - memcpy(&sock_addr.sin_addr,hp->h_addr, (size_t) hp->h_length); - } -#endif sock_addr.sin_port = (ushort) htons((ushort) port); if (connect2(sock,(struct sockaddr *) &sock_addr, sizeof(sock_addr), mysql->options.connect_timeout) <0) -- cgit v1.2.1