Commit 975b4969 authored by bar@mysql.com's avatar bar@mysql.com

charset.c:

  Bug#12109 possible locking bug in init_available_charset
  Recheck charset_initialized inside locked code,
  to garantee two threads are not entering
  consequently.
parent ef3bc773
...@@ -383,7 +383,8 @@ static my_bool init_available_charsets(myf myflags) ...@@ -383,7 +383,8 @@ static my_bool init_available_charsets(myf myflags)
while we may changing the cs_info_table while we may changing the cs_info_table
*/ */
pthread_mutex_lock(&THR_LOCK_charset); pthread_mutex_lock(&THR_LOCK_charset);
if (!charset_initialized)
{
bzero(&all_charsets,sizeof(all_charsets)); bzero(&all_charsets,sizeof(all_charsets));
init_compiled_charsets(myflags); init_compiled_charsets(myflags);
...@@ -403,6 +404,7 @@ static my_bool init_available_charsets(myf myflags) ...@@ -403,6 +404,7 @@ static my_bool init_available_charsets(myf myflags)
strmov(get_charsets_dir(fname), MY_CHARSET_INDEX); strmov(get_charsets_dir(fname), MY_CHARSET_INDEX);
error= my_read_charset_file(fname,myflags); error= my_read_charset_file(fname,myflags);
charset_initialized=1; charset_initialized=1;
}
pthread_mutex_unlock(&THR_LOCK_charset); pthread_mutex_unlock(&THR_LOCK_charset);
} }
return error; return error;
......
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