From 5fcba6eb264e0f0af2eb83502bc8da031bef567f Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sat, 28 Mar 2015 10:55:31 +0100 Subject: [PATCH] small cleanup * my_aes.h doesn't compile without my_global.h * typo in a comment * redundant condition * if encryption plugin fails, there's no encryption_key_manager at plugin deinit time * encryption plugin tests must run when plugin.so is present, not when a plugin is active (otherwise the test will be skipped when plugin fails to initialize). --- include/my_aes.h | 2 ++ include/mysql/service_thd_alloc.h | 2 +- mysql-test/include/have_example_key_management_plugin.inc | 3 +-- mysql-test/include/have_file_key_management_plugin.inc | 3 +-- mysys/my_fopen.c | 3 +-- sql/encryption_keys.cc | 5 ++--- 6 files changed, 8 insertions(+), 10 deletions(-) diff --git a/include/my_aes.h b/include/my_aes.h index e7376a6b08e..824fa5540ef 100644 --- a/include/my_aes.h +++ b/include/my_aes.h @@ -22,6 +22,8 @@ #ifndef MY_AES_INCLUDED #define MY_AES_INCLUDED +#include + typedef int Crypt_result; #define AES_OK 0 diff --git a/include/mysql/service_thd_alloc.h b/include/mysql/service_thd_alloc.h index 645fb310cbc..e92f81b52c3 100644 --- a/include/mysql/service_thd_alloc.h +++ b/include/mysql/service_thd_alloc.h @@ -16,7 +16,7 @@ /** @file - This service provdes functions to allocate memory in a connection local + This service provides functions to allocate memory in a connection local memory pool. The memory allocated there will be automatically freed at the end of the statement, don't use it for allocations that should live longer than that. For short living allocations this is more efficient than diff --git a/mysql-test/include/have_example_key_management_plugin.inc b/mysql-test/include/have_example_key_management_plugin.inc index 756a9e39f3d..d04aad2532f 100644 --- a/mysql-test/include/have_example_key_management_plugin.inc +++ b/mysql-test/include/have_example_key_management_plugin.inc @@ -1,7 +1,6 @@ -- source encryption_algorithms.inc -if (`select count(*) = 0 from information_schema.plugins - where plugin_name = 'example_key_management' and plugin_status='active'`) +if (!$EXAMPLE_KEY_MANAGEMENT_SO) { --skip Needs example_key_management } diff --git a/mysql-test/include/have_file_key_management_plugin.inc b/mysql-test/include/have_file_key_management_plugin.inc index cd2f9510a53..f85214332f7 100644 --- a/mysql-test/include/have_file_key_management_plugin.inc +++ b/mysql-test/include/have_file_key_management_plugin.inc @@ -1,7 +1,6 @@ -- source encryption_algorithms.inc -if (`select count(*) = 0 from information_schema.plugins - where plugin_name = 'file_key_management' and plugin_status='active'`) +if (!$FILE_KEY_MANAGEMENT_SO) { --skip Needs file_key_management } diff --git a/mysys/my_fopen.c b/mysys/my_fopen.c index ede434f2c32..3ec5e0ba0b1 100644 --- a/mysys/my_fopen.c +++ b/mysys/my_fopen.c @@ -87,8 +87,7 @@ FILE *my_fopen(const char *filename, int flags, myf MyFlags) my_errno=errno; DBUG_PRINT("error",("Got error %d on open",my_errno)); if (MyFlags & (MY_FFNF | MY_FAE | MY_WME)) - my_error((flags & O_RDONLY) || (flags == O_RDONLY ) ? EE_FILENOTFOUND : - EE_CANTCREATEFILE, + my_error((flags & O_RDONLY) ? EE_FILENOTFOUND : EE_CANTCREATEFILE, MYF(ME_BELL+ME_WAITTANG), filename, my_errno); DBUG_RETURN((FILE*) 0); } /* my_fopen */ diff --git a/sql/encryption_keys.cc b/sql/encryption_keys.cc index 160c2fd55d7..f3e8fe6a9d2 100644 --- a/sql/encryption_keys.cc +++ b/sql/encryption_keys.cc @@ -59,14 +59,13 @@ int initialize_encryption_key_management_plugin(st_plugin_int *plugin) int finalize_encryption_key_management_plugin(st_plugin_int *plugin) { - DBUG_ASSERT(encryption_key_manager); - if (plugin->plugin->deinit && plugin->plugin->deinit(NULL)) { DBUG_PRINT("warning", ("Plugin '%s' deinit function returned error.", plugin->name.str)); } - plugin_unlock(NULL, encryption_key_manager); + if (encryption_key_manager) + plugin_unlock(NULL, encryption_key_manager); encryption_key_manager= 0; return 0; }