diff options
author | Georgi Kodinov <Georgi.Kodinov@Oracle.com> | 2012-01-16 12:04:28 +0200 |
---|---|---|
committer | Georgi Kodinov <Georgi.Kodinov@Oracle.com> | 2012-01-16 12:04:28 +0200 |
commit | 10543a4a2eb68ecb618936b57d62c6ca1f7eb6bb (patch) | |
tree | c133db3140174826fa9f7c4fd4b904e527927dd8 /sql/sql_udf.cc | |
parent | a2248579d1830de1714aa8637dc2a1775660ee2e (diff) | |
download | mariadb-git-10543a4a2eb68ecb618936b57d62c6ca1f7eb6bb.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_udf.cc')
-rw-r--r-- | sql/sql_udf.cc | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/sql/sql_udf.cc b/sql/sql_udf.cc index bf2de4b39bb..44595ace453 100644 --- a/sql/sql_udf.cc +++ b/sql/sql_udf.cc @@ -221,10 +221,15 @@ void udf_init() char dlpath[FN_REFLEN]; strxnmov(dlpath, sizeof(dlpath) - 1, opt_plugin_dir, "/", tmp->dl, NullS); + (void) unpack_filename(dlpath, dlpath); if (!(dl= dlopen(dlpath, RTLD_NOW))) { + const char *errmsg; + int error_number= dlopen_errno; + DLERROR_GENERATE(errmsg, error_number); + /* Print warning to log */ - sql_print_error(ER(ER_CANT_OPEN_LIBRARY), tmp->dl, errno, dlerror()); + sql_print_error(ER(ER_CANT_OPEN_LIBRARY), tmp->dl, error_number, errmsg); /* Keep the udf in the hash so that we can remove it later */ continue; } @@ -469,12 +474,18 @@ int mysql_create_function(THD *thd,udf_func *udf) { char dlpath[FN_REFLEN]; strxnmov(dlpath, sizeof(dlpath) - 1, opt_plugin_dir, "/", udf->dl, NullS); + (void) unpack_filename(dlpath, dlpath); + if (!(dl = dlopen(dlpath, RTLD_NOW))) { + const char *errmsg; + int error_number= dlopen_errno; + DLERROR_GENERATE(errmsg, error_number); + DBUG_PRINT("error",("dlopen of %s failed, error: %d (%s)", - udf->dl, errno, dlerror())); + udf->dl, error_number, errmsg)); my_error(ER_CANT_OPEN_LIBRARY, MYF(0), - udf->dl, errno, dlerror()); + udf->dl, error_number, errmsg); goto err; } new_dl=1; |