summaryrefslogtreecommitdiff
path: root/include/my_global.h
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 /include/my_global.h
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 'include/my_global.h')
-rw-r--r--include/my_global.h26
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 */
/*