summaryrefslogtreecommitdiff
path: root/sql/hostname.cc
diff options
context:
space:
mode:
authormonty@mysql.com <>2003-11-22 03:21:40 +0200
committermonty@mysql.com <>2003-11-22 03:21:40 +0200
commitd87494c5acf1b0e03cb3848b3e588c1d0259b44f (patch)
treef843dfed18127f94f90e6cffa6456e545f7b6b57 /sql/hostname.cc
parentd08945498e44acb968d1aab6d269d9b1874246e6 (diff)
downloadmariadb-git-d87494c5acf1b0e03cb3848b3e588c1d0259b44f.tar.gz
Don't flush cur_log (relay log) on flush_relay_log_info becasue this crashes the server if cur_log is 'hot' and the io_thread has changed log file.
Updated project files for windows Made rpl_change_master.test portable Ensure that mutex are not freed if not initilized
Diffstat (limited to 'sql/hostname.cc')
-rw-r--r--sql/hostname.cc12
1 files changed, 8 insertions, 4 deletions
diff --git a/sql/hostname.cc b/sql/hostname.cc
index 5c4bde99256..c9cb2a43963 100644
--- a/sql/hostname.cc
+++ b/sql/hostname.cc
@@ -61,23 +61,27 @@ bool hostname_cache_init()
{
host_entry tmp;
uint offset= (uint) ((char*) (&tmp.ip) - (char*) &tmp);
- (void) pthread_mutex_init(&LOCK_hostname,MY_MUTEX_INIT_SLOW);
-
if (!(hostname_cache=new hash_filo(HOST_CACHE_SIZE, offset,
sizeof(struct in_addr),NULL,
(hash_free_key) free,
&my_charset_latin1)))
return 1;
hostname_cache->clear();
+ (void) pthread_mutex_init(&LOCK_hostname,MY_MUTEX_INIT_SLOW);
return 0;
}
void hostname_cache_free()
{
- (void) pthread_mutex_destroy(&LOCK_hostname);
- delete hostname_cache;
+ if (hostname_cache)
+ {
+ (void) pthread_mutex_destroy(&LOCK_hostname);
+ delete hostname_cache;
+ hostname_cache= 0;
+ }
}
+
static void add_hostname(struct in_addr *in,const char *name)
{
if (!(specialflag & SPECIAL_NO_HOST_CACHE))