summaryrefslogtreecommitdiff
path: root/sql-common
diff options
context:
space:
mode:
authorAlexey Kopytov <Alexey.Kopytov@sun.com>2009-02-27 11:26:06 +0200
committerAlexey Kopytov <Alexey.Kopytov@sun.com>2009-02-27 11:26:06 +0200
commitf7cf8e57c12f435980bafb4f4b9c657a722345a4 (patch)
treeede7660d1ce7a18f7267f3cd27a0fff7cbcc8675 /sql-common
parent87fcb23d4b509f4b3b00f0e282b44f790a9cb2fd (diff)
downloadmariadb-git-f7cf8e57c12f435980bafb4f4b9c657a722345a4.tar.gz
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(). mysys/default.c: 1. Added a thread-safe version of load_defaults(), changed load_defaults() with the old interface to be a thread-unsafe wrapper around the thread-safe version. 2. Always use a private MEM_ROOT in my_print_default_files, don't use a global variable. sql-common/client.c: Use a thread-safe version of load_defaults().
Diffstat (limited to 'sql-common')
-rw-r--r--sql-common/client.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sql-common/client.c b/sql-common/client.c
index 63c746a3f5a..91a47b6a6f8 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -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;