summaryrefslogtreecommitdiff
path: root/sql
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
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')
-rw-r--r--sql/des_key_file.cc18
-rw-r--r--sql/item_strfunc.cc11
-rw-r--r--sql/log.cc3
-rw-r--r--sql/mysql_priv.h1
-rw-r--r--sql/net_serv.cc2
-rw-r--r--sql/slave.cc2
6 files changed, 30 insertions, 7 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 ||
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index ccc56adf007..dcb539476a1 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -378,6 +378,9 @@ String *Item_func_des_encrypt::val_str(String *str)
if (arg_count == 1)
{
+ /* Make sure LOCK_des_key_file was initialized. */
+ init_des_key_file();
+
/* Protect against someone doing FLUSH DES_KEY_FILE */
VOID(pthread_mutex_lock(&LOCK_des_key_file));
keyschedule= des_keyschedule[key_number=des_default_key];
@@ -388,6 +391,10 @@ String *Item_func_des_encrypt::val_str(String *str)
key_number= (uint) args[1]->val_int();
if (key_number > 9)
goto error;
+
+ /* Make sure LOCK_des_key_file was initialized. */
+ init_des_key_file();
+
VOID(pthread_mutex_lock(&LOCK_des_key_file));
keyschedule= des_keyschedule[key_number];
VOID(pthread_mutex_unlock(&LOCK_des_key_file));
@@ -474,6 +481,10 @@ String *Item_func_des_decrypt::val_str(String *str)
// Check if automatic key and that we have privilege to uncompress using it
if (!(current_thd->master_access & SUPER_ACL) || key_number > 9)
goto error;
+
+ /* Make sure LOCK_des_key_file was initialized. */
+ init_des_key_file();
+
VOID(pthread_mutex_lock(&LOCK_des_key_file));
keyschedule= des_keyschedule[key_number];
VOID(pthread_mutex_unlock(&LOCK_des_key_file));
diff --git a/sql/log.cc b/sql/log.cc
index e69c0af15bd..44fff28b612 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -1154,6 +1154,9 @@ int MYSQL_LOG::purge_logs(const char *to_log,
*/
if (my_stat(log_info.log_file_name,&s,MYF(0)))
file_size= s.st_size;
+ else
+ sql_print_information("Failed to execute my_stat on file '%s'",
+ log_info.log_file_name);
}
/*
It's not fatal if we can't delete a log file ;
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 9a3684c3865..c79a980ffdb 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -786,6 +786,7 @@ extern char *des_key_file;
extern struct st_des_keyschedule des_keyschedule[10];
extern uint des_default_key;
extern pthread_mutex_t LOCK_des_key_file;
+void init_des_key_file();
bool load_des_key_file(const char *file_name);
void free_des_key_file();
#endif /* HAVE_OPENSSL */
diff --git a/sql/net_serv.cc b/sql/net_serv.cc
index 44539ec2d74..9f6295f8a36 100644
--- a/sql/net_serv.cc
+++ b/sql/net_serv.cc
@@ -135,7 +135,7 @@ my_bool my_net_init(NET *net, Vio* vio)
if (vio != 0) /* If real connection */
{
net->fd = vio_fd(vio); /* For perl DBI/DBD */
-#if defined(MYSQL_SERVER) && !defined(___WIN__) && !defined(__EMX__) && !defined(OS2)
+#if defined(MYSQL_SERVER) && !defined(__WIN__) && !defined(__EMX__) && !defined(OS2)
if (!(test_flags & TEST_BLOCKING))
{
my_bool old_mode;
diff --git a/sql/slave.cc b/sql/slave.cc
index c6c0de7160b..33f27064aab 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -4968,6 +4968,7 @@ void rotate_relay_log(MASTER_INFO* mi)
/* We don't lock rli->run_lock. This would lead to deadlocks. */
pthread_mutex_lock(&mi->run_lock);
+ pthread_mutex_lock(&mi->data_lock);
/*
We need to test inited because otherwise, new_file() will attempt to lock
@@ -4997,6 +4998,7 @@ void rotate_relay_log(MASTER_INFO* mi)
*/
rli->relay_log.harvest_bytes_written(&rli->log_space_total);
end:
+ pthread_mutex_unlock(&mi->data_lock);
pthread_mutex_unlock(&mi->run_lock);
DBUG_VOID_RETURN;
}