diff options
author | Mats Kindahl <mats.kindahl@oracle.com> | 2011-08-15 20:12:11 +0200 |
---|---|---|
committer | Mats Kindahl <mats.kindahl@oracle.com> | 2011-08-15 20:12:11 +0200 |
commit | cf5e5f837a06d29e6806eea3c47192dc6dd483da (patch) | |
tree | a54b38fc92199ba1d0a8467adb980856f5effafe /sql/sql_plugin.cc | |
parent | cfb4a7c2ff93a3a653f84d85e5f4b3df16e4f09a (diff) | |
download | mariadb-git-cf5e5f837a06d29e6806eea3c47192dc6dd483da.tar.gz |
Merging into mysql-5.5.16-release.
Diffstat (limited to 'sql/sql_plugin.cc')
-rw-r--r-- | sql/sql_plugin.cc | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 015cbe31a15..5f5e73091ff 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -539,6 +539,11 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report) #endif } + /* + What's the purpose of this loop? If the goal is to catch a + missing 0 record at the end of a list, it will fail miserably + since the compiler is likely to optimize this away. /Matz + */ for (i= 0; ((struct st_mysql_plugin *)(ptr+i*sizeof_st_plugin))->info; i++) @@ -567,6 +572,23 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report) } plugin_dl.plugins= (struct st_mysql_plugin *)sym; + /* + If report is REPORT_TO_USER, we were called from + mysql_install_plugin. Otherwise, we are called directly or + indirectly from plugin_init. + */ + if (report == REPORT_TO_USER) + { + st_mysql_plugin *plugin= plugin_dl.plugins; + for ( ; plugin->info ; ++plugin) + if (plugin->flags & PLUGIN_OPT_NO_INSTALL) + { + report_error(report, ER_PLUGIN_NO_INSTALL, plugin->name); + free_plugin_mem(&plugin_dl); + DBUG_RETURN(0); + } + } + /* Duplicate and convert dll name */ plugin_dl.dl.length= dl->length * files_charset_info->mbmaxlen + 1; if (! (plugin_dl.dl.str= (char*) my_malloc(plugin_dl.dl.length, MYF(0)))) @@ -1884,6 +1906,16 @@ bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name) my_error(ER_PLUGIN_IS_PERMANENT, MYF(0), name->str); goto err; } + /* + Error message for ER_PLUGIN_IS_PERMANENT is not suitable for + plugins marked as not dynamically uninstallable, so we have a + separate one instead of changing the old one. + */ + if (plugin->plugin->flags & PLUGIN_OPT_NO_UNINSTALL) + { + my_error(ER_PLUGIN_NO_UNINSTALL, MYF(0), plugin->plugin->name); + goto err; + } plugin->state= PLUGIN_IS_DELETED; if (plugin->ref_count) |