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 /include | |
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 'include')
-rw-r--r-- | include/my_global.h | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/include/my_global.h b/include/my_global.h index 924c83cd951..11ff377c706 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -1364,11 +1364,31 @@ do { doubleget_union _tmp; \ #ifndef HAVE_DLERROR #ifdef _WIN32 +#define DLERROR_GENERATE(errmsg, error_number) \ + char win_errormsg[2048]; \ + if(FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, \ + 0, error_number, 0, win_errormsg, 2048, NULL)) \ + { \ + char *ptr; \ + for (ptr= &win_errormsg[0] + strlen(win_errormsg) - 1; \ + ptr >= &win_errormsg[0] && strchr("\r\n\t\0x20", *ptr); \ + ptr--) \ + *ptr= 0; \ + errmsg= win_errormsg; \ + } \ + else \ + errmsg= "" #define dlerror() "" -#else +#define dlopen_errno GetLastError() +#else /* _WIN32 */ #define dlerror() "No support for dynamic loading (static build?)" -#endif -#endif +#define DLERROR_GENERATE(errmsg, error_number) errmsg= dlerror() +#define dlopen_errno errno +#endif /* _WIN32 */ +#else /* HAVE_DLERROR */ +#define DLERROR_GENERATE(errmsg, error_number) errmsg= dlerror() +#define dlopen_errno errno +#endif /* HAVE_DLERROR */ /* |