summaryrefslogtreecommitdiff
path: root/sql/des_key_file.cc
diff options
context:
space:
mode:
authorunknown <lars@mysql.com>2005-07-13 02:13:04 +0200
committerunknown <lars@mysql.com>2005-07-13 02:13:04 +0200
commit8daa1c422927964741c2977aea50567558d5f607 (patch)
tree288cefd45b67649d427ee7a8a02969119055a4a4 /sql/des_key_file.cc
parent1c8ef0cbd025557fc34f02d9a8cc99a392579141 (diff)
parent73fd169d0215700583f335c6e42243e3fa1553c4 (diff)
downloadmariadb-git-8daa1c422927964741c2977aea50567558d5f607.tar.gz
Merge mysql.com:/home/bkroot/mysql-4.1
into mysql.com:/home/bk/mysql-5.0 BitKeeper/etc/config: Auto merged include/my_global.h: Auto merged sql/des_key_file.cc: Auto merged sql/item_strfunc.cc: Auto merged sql/mysql_priv.h: Auto merged sql/net_serv.cc: Auto merged vio/vio.c: Auto merged vio/viosocket.c: Auto merged sql/log.cc: Manual merge sql/slave.cc: Manual merge
Diffstat (limited to 'sql/des_key_file.cc')
-rw-r--r--sql/des_key_file.cc18
1 files changed, 12 insertions, 6 deletions
diff --git a/sql/des_key_file.cc b/sql/des_key_file.cc
index a5a3e78d70f..34bcbd4fc4b 100644
--- a/sql/des_key_file.cc
+++ b/sql/des_key_file.cc
@@ -22,7 +22,17 @@
struct st_des_keyschedule des_keyschedule[10];
uint des_default_key;
pthread_mutex_t LOCK_des_key_file;
-static int initialized;
+static int initialized= 0;
+
+void
+init_des_key_file()
+{
+ if (!initialized)
+ {
+ initialized=1;
+ pthread_mutex_init(&LOCK_des_key_file,MY_MUTEX_INIT_FAST);
+ }
+}
/*
Function which loads DES keys from plaintext file into memory on MySQL
@@ -45,11 +55,7 @@ load_des_key_file(const char *file_name)
DBUG_ENTER("load_des_key_file");
DBUG_PRINT("enter",("name: %s",file_name));
- if (!initialized)
- {
- initialized=1;
- pthread_mutex_init(&LOCK_des_key_file,MY_MUTEX_INIT_FAST);
- }
+ init_des_key_file();
VOID(pthread_mutex_lock(&LOCK_des_key_file));
if ((file=my_open(file_name,O_RDONLY | O_BINARY ,MYF(MY_WME))) < 0 ||