#At file:///home/georg/work/mysql/connectors/connector-c/ based on revid:georg.richter@stripped
2909 Georg Richter 2010-09-27
return a more informative errormessage on Windows
modified:
libmysql/plugin.c
=== modified file 'libmysql/plugin.c'
--- a/libmysql/plugin.c 2010-09-23 07:11:46 +0000
+++ b/libmysql/plugin.c 2010-09-27 09:21:43 +0000
@@ -340,6 +340,9 @@ struct st_mysql_client_plugin *
STDCALL mysql_load_client_plugin_v(MYSQL *mysql, const char *plugin_name, int argc, va_list args)
{
char *errormsg;
+#ifdef WIN32
+ my_bool dl_error= 0;
+#endif
void *dl= NULL;
struct st_mysql_client_plugin *plugin;
void *sym;
@@ -370,7 +373,13 @@ STDCALL mysql_load_client_plugin_v(MYSQL
/* try to load plugin */
if(!(dl= dlopen(dlpath, RTLD_NOW)))
{
+#ifdef WIN32
+ FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM & FORMAT_MESSAGE_ALLOCATE_BUFFER,
+ 0, GetLastError(), 0, errormsg, 0, NULL);
+ dl_error= 1;
+#else
errormsg= dlerror();
+#endif
goto error;
}
@@ -391,6 +400,11 @@ error:
pthread_mutex_unlock(&LOCK_load_client_plugin);
set_mysql_extended_error(mysql, CR_PLUGIN_CANNOT_LOAD, unknown_sqlstate,
ER(CR_PLUGIN_CANNOT_LOAD), plugin_name, errormsg);
+#ifdef WIN32
+ /* free memory allocated by FormatMessage */
+ if (dl_error)
+ LocalFree(errormsg);
+#endif
DBUG_RETURN(NULL);
}
Attachment: [text/bzr-bundle] bzr/georg.richter@sun.com-20100927092143-ssrr7mjc988a41th.bundle
| Thread |
|---|
| • bzr commit into libmysql branch (georg.richter:2909) | Georg Richter | 27 Sep |