diff options
author | Michael Widenius <monty@askmonty.org> | 2010-01-29 20:42:22 +0200 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2010-01-29 20:42:22 +0200 |
commit | e9bce6c9d4bde35306b845e22e9b5ada69c4512f (patch) | |
tree | b4e7251729b81216e6d66d5bf8dee7d7c315cc26 /client/mysqlslap.c | |
parent | ea0380f43c5deefbe2c2f91c5e9fb38ffae8b15d (diff) | |
download | mariadb-git-e9bce6c9d4bde35306b845e22e9b5ada69c4512f.tar.gz |
Patch set contributed by Alex Budovski (MCA)
Fix for Bug#31173: mysqlslap.exe crashes if called without any parameters
.bzrignore:
Fixed .bzrignore rules. Many were simply not ignoring what they were meant to.
client/mysqlslap.c:
Fixed bug for Bug#31173: mysqlslap.exe crashes if called without any parameters
The original patch could cause memory leaks and odd problems depending on how connection was made.
This code ensures that all mysql_options() are set for each mysql_real_connect().
(This patch by Monty)
mysys/my_thr_init.c:
Fixed multiply-initialized critical section on Windows, due to code incorrectly
checking the wrong field in an attempt to prevent multiple-initialization.
sql-common/client.c:
Don't use shared memory if it's not set (for example after failed mysql_real_connect).
Ensure that mysql_close() resets all resources so that it's safe to call it twice.
(Patch by monty, related to Bug#31173: mysqlslap.exe crashes if called without any parameters)
sql/CMakeLists.txt:
Added page fault counters for SHOW PROFILE on Windows.
sql/mysqld.cc:
Fixed attempt to set a NULL event. The code now only sets the event if appropriate (i.e. shared memory is being used)
sql/sql_profile.cc:
Added page fault counters for SHOW PROFILE on Windows.
sql/sql_profile.h:
Added page fault counters for SHOW PROFILE on Windows.
sql/udf_example.def:
Some cleanup functions were not exported from udf_example.dll, causing them to
never be executed, and as a result multiple-initialization of kernel objects
occurred and resources were not being freed correctly.
storage/maria/ma_close.c:
Condition variable share->key_del_cond was never being destroyed, while its
containing heap block was being freed in maria_close(), leaking kernel
resources.
Diffstat (limited to 'client/mysqlslap.c')
-rw-r--r-- | client/mysqlslap.c | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/client/mysqlslap.c b/client/mysqlslap.c index 43d963cc22f..c9c7e057202 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -292,6 +292,25 @@ static int gettimeofday(struct timeval *tp, void *tzp) } #endif +void set_mysql_connect_options(MYSQL *mysql) +{ + if (opt_compress) + mysql_options(mysql,MYSQL_OPT_COMPRESS,NullS); +#ifdef HAVE_OPENSSL + if (opt_use_ssl) + mysql_ssl_set(mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca, + opt_ssl_capath, opt_ssl_cipher); +#endif + if (opt_protocol) + mysql_options(mysql,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol); +#ifdef HAVE_SMEM + if (shared_memory_base_name) + mysql_options(mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name); +#endif + mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset); +} + + int main(int argc, char **argv) { MYSQL mysql; @@ -323,20 +342,7 @@ int main(int argc, char **argv) exit(1); } mysql_init(&mysql); - if (opt_compress) - mysql_options(&mysql,MYSQL_OPT_COMPRESS,NullS); -#ifdef HAVE_OPENSSL - if (opt_use_ssl) - mysql_ssl_set(&mysql, opt_ssl_key, opt_ssl_cert, opt_ssl_ca, - opt_ssl_capath, opt_ssl_cipher); -#endif - if (opt_protocol) - mysql_options(&mysql,MYSQL_OPT_PROTOCOL,(char*)&opt_protocol); -#ifdef HAVE_SMEM - if (shared_memory_base_name) - mysql_options(&mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name); -#endif - mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset); + set_mysql_connect_options(&mysql); if (!opt_only_print) { @@ -1815,6 +1821,7 @@ pthread_handler_t run_task(void *p) my_progname, mysql_error(mysql)); exit(0); } + set_mysql_connect_options(mysql); if (mysql_thread_init()) { @@ -1855,7 +1862,6 @@ limit_not_met: my_progname, mysql_error(mysql)); exit(0); } - if (slap_connect(mysql)) goto end; } @@ -2223,6 +2229,7 @@ slap_connect(MYSQL *mysql) int x, connect_error= 1; for (x= 0; x < 10; x++) { + set_mysql_connect_options(mysql); if (mysql_real_connect(mysql, host, user, opt_password, create_schema_string, opt_mysql_port, |