summaryrefslogtreecommitdiff
path: root/sql/sql_plugin.cc
diff options
context:
space:
mode:
authorunknown <serg@serg.mylan>2006-02-07 15:24:34 +0100
committerunknown <serg@serg.mylan>2006-02-07 15:24:34 +0100
commit8017e9c4e726f8ab6b8b2c71f81e0e0036c21fcd (patch)
tree2286b6f243b368fbdb5a7d2de2f9c8e1cf89718a /sql/sql_plugin.cc
parent6a9a35c0d451429a71ddbfd3c4b1db1700be9ad3 (diff)
downloadmariadb-git-8017e9c4e726f8ab6b8b2c71f81e0e0036c21fcd.tar.gz
fixes for the ER_CANT_OPEN_LIBRARY message
sql/share/errmsg.txt: .64s is too short for dlerror() messages sql/sql_plugin.cc: 1. dlerror() cannot be called twice 2. remove dlpath from dlerror() messages
Diffstat (limited to 'sql/sql_plugin.cc')
-rw-r--r--sql/sql_plugin.cc17
1 files changed, 13 insertions, 4 deletions
diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc
index b8628b18dd4..9fee7abb619 100644
--- a/sql/sql_plugin.cc
+++ b/sql/sql_plugin.cc
@@ -105,7 +105,7 @@ static st_plugin_dl *plugin_dl_add(LEX_STRING *dl, int report)
{
#ifdef HAVE_DLOPEN
char dlpath[FN_REFLEN];
- uint plugin_dir_len, dummy_errors;
+ uint plugin_dir_len, dummy_errors, dlpathlen;
struct st_plugin_dl *tmp, plugin_dl;
void *sym;
DBUG_ENTER("plugin_dl_add");
@@ -133,15 +133,24 @@ static st_plugin_dl *plugin_dl_add(LEX_STRING *dl, int report)
}
bzero(&plugin_dl, sizeof(plugin_dl));
/* Compile dll path */
- strxnmov(dlpath, sizeof(dlpath) - 1, opt_plugin_dir, "/", dl->str, NullS);
+ dlpathlen=
+ strxnmov(dlpath, sizeof(dlpath) - 1, opt_plugin_dir, "/", dl->str, NullS) -
+ dlpath;
plugin_dl.ref_count= 1;
/* Open new dll handle */
if (!(plugin_dl.handle= dlopen(dlpath, RTLD_NOW)))
{
+ const char *errmsg=dlerror();
+ if (!strncmp(dlpath, errmsg, dlpathlen))
+ { // if errmsg starts from dlpath, trim this prefix.
+ errmsg+=dlpathlen;
+ if (*errmsg == ':') errmsg++;
+ if (*errmsg == ' ') errmsg++;
+ }
if (report & REPORT_TO_USER)
- my_error(ER_CANT_OPEN_LIBRARY, MYF(0), dlpath, errno, dlerror());
+ my_error(ER_CANT_OPEN_LIBRARY, MYF(0), dlpath, errno, errmsg);
if (report & REPORT_TO_LOG)
- sql_print_error(ER(ER_CANT_OPEN_LIBRARY), dlpath, errno, dlerror());
+ sql_print_error(ER(ER_CANT_OPEN_LIBRARY), dlpath, errno, errmsg);
DBUG_RETURN(0);
}
/* Determine interface version */