Fix for bug #40552: Race condition around default_directories

in load_defaults() 

load_defaults(), my_search_option_files() and 
my_print_default_files()  utilized a global variable 
containing  a pointer to thread local memory. This could lead 
to race conditions when those functions were called with high 
concurrency. 

Fixed by changing the interface of the said functions to avoid 
the necessity for using a global variable.

Since we cannot change load_defaults() prototype for API
compatibility reasons, it was renamed my_load_defaults().
Now load_defaults() is a thread-unsafe wrapper around
a thread-safe version, my_load_defaults().
This commit is contained in:
Alexey Kopytov 2009-02-27 11:26:06 +02:00
commit 752cbab9a4
6 changed files with 65 additions and 19 deletions

View file

@ -1021,7 +1021,7 @@ void mysql_read_default_options(struct st_mysql_options *options,
argc=1; argv=argv_buff; argv_buff[0]= (char*) "client";
groups[0]= (char*) "client"; groups[1]= (char*) group; groups[2]=0;
load_defaults(filename, groups, &argc, &argv);
my_load_defaults(filename, groups, &argc, &argv, NULL);
if (argc != 1) /* If some default option */
{
char **option=argv;