diff options
author | unknown <monty@mashka.mysql.fi> | 2003-01-18 23:38:55 +0200 |
---|---|---|
committer | unknown <monty@mashka.mysql.fi> | 2003-01-18 23:38:55 +0200 |
commit | bd70549275027c4c2202038034408721f1aa6367 (patch) | |
tree | 703d5ea8aadf0b93d054208757abd10c516d22f7 /sql/sql_db.cc | |
parent | d26a7d483c53e83bf2d93d439f330c1826055b85 (diff) | |
download | mariadb-git-bd70549275027c4c2202038034408721f1aa6367.tar.gz |
Only set thd->query to 0 if LOCK_thread_count is hold
This fixes a possible core dump problem in SHOW PROCESSLIST
sql/slave.cc:
Only set thd->query to 0 if LOCK_thread_count is hold
sql/sql_db.cc:
Only set thd->query to 0 if LOCK_thread_count is hold
Also first set query_length, then query
sql/sql_parse.cc:
Indentation changes
Diffstat (limited to 'sql/sql_db.cc')
-rw-r--r-- | sql/sql_db.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/sql/sql_db.cc b/sql/sql_db.cc index 0be1b7b0411..1ba02bb416c 100644 --- a/sql/sql_db.cc +++ b/sql/sql_db.cc @@ -89,9 +89,9 @@ void mysql_create_db(THD *thd, char *db, uint create_options) } if (!thd->query) { - thd->query = path; thd->query_length = (uint) (strxmov(path,"create database ", db, NullS)- path); + thd->query = path; } { mysql_update_log.write(thd,thd->query, thd->query_length); @@ -103,8 +103,9 @@ void mysql_create_db(THD *thd, char *db, uint create_options) } if (thd->query == path) { + VOID(pthread_mutex_lock(&LOCK_thread_count)); thd->query = 0; // just in case - thd->query_length = 0; + VOID(pthread_mutex_unlock(&LOCK_thread_count)); } send_ok(&thd->net, result); @@ -178,9 +179,9 @@ void mysql_rm_db(THD *thd,char *db,bool if_exists) if (!thd->query) { - thd->query = path; thd->query_length = (uint) (strxmov(path,"drop database ", db, NullS)- path); + thd->query = path; } mysql_update_log.write(thd, thd->query, thd->query_length); if (mysql_bin_log.is_open()) @@ -190,8 +191,9 @@ void mysql_rm_db(THD *thd,char *db,bool if_exists) } if (thd->query == path) { + VOID(pthread_mutex_lock(&LOCK_thread_count)); thd->query = 0; // just in case - thd->query_length = 0; + VOID(pthread_mutex_unlock(&LOCK_thread_count)); } send_ok(&thd->net,(ulong) deleted); } |