summaryrefslogtreecommitdiff
path: root/sql/sql_plugin.cc
diff options
context:
space:
mode:
authorGeorgi Kodinov <Georgi.Kodinov@Oracle.com>2012-01-16 12:04:28 +0200
committerGeorgi Kodinov <Georgi.Kodinov@Oracle.com>2012-01-16 12:04:28 +0200
commit0e48b69cba704bf18e1fccb7b44eb6b991401790 (patch)
treec133db3140174826fa9f7c4fd4b904e527927dd8 /sql/sql_plugin.cc
parentb3ffe9132bdbc3981560152ea441d1f01481d27b (diff)
downloadmariadb-git-0e48b69cba704bf18e1fccb7b44eb6b991401790.tar.gz
Bug #11754014: 45549: udf plugin_dir path separator inconsistency
and cryptic error 1126 message The problem was that dlopen() related code was using just a subset of the path normalization routines used in other places. Fixed the expansion of the pre-dlopen() behavior for plugins and UDFs to use a platform-dependent consistent encoding of the paths. Fixed the error dlopen() error handling to take the correct error message and strip off the trailing newline character(s). Fixed tests to do a platform independent replace of directories and to account for the traling slash.
Diffstat (limited to 'sql/sql_plugin.cc')
-rw-r--r--sql/sql_plugin.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index 2b801b65a09..4a2d450f373 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -463,18 +463,22 @@ static st_plugin_dl *plugin_dl_add(const LEX_STRING *dl, int report)
dlpathlen=
strxnmov(dlpath, sizeof(dlpath) - 1, opt_plugin_dir, "/", dl->str, NullS) -
dlpath;
+ (void) unpack_filename(dlpath, dlpath);
plugin_dl.ref_count= 1;
/* Open new dll handle */
if (!(plugin_dl.handle= dlopen(dlpath, RTLD_NOW)))
{
- const char *errmsg=dlerror();
+ const char *errmsg;
+ int error_number= dlopen_errno;
+ DLERROR_GENERATE(errmsg, error_number);
+
if (!strncmp(dlpath, errmsg, dlpathlen))
{ // if errmsg starts from dlpath, trim this prefix.
errmsg+=dlpathlen;
if (*errmsg == ':') errmsg++;
if (*errmsg == ' ') errmsg++;
}
- report_error(report, ER_CANT_OPEN_LIBRARY, dlpath, errno, errmsg);
+ report_error(report, ER_CANT_OPEN_LIBRARY, dlpath, error_number, errmsg);
DBUG_RETURN(0);
}
/* Determine interface version */