From 0e48b69cba704bf18e1fccb7b44eb6b991401790 Mon Sep 17 00:00:00 2001 From: Georgi Kodinov Date: Mon, 16 Jan 2012 12:04:28 +0200 Subject: 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. --- include/my_global.h | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'include/my_global.h') 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 */ /* -- cgit v1.2.1