summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2012-05-03 18:25:27 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2012-05-03 18:25:27 +0200
commitfdcaca6b85d65ef2c9b4814cc4a9adda4568e24f (patch)
tree21e07bd93a7bc45fd9b5b1084a88a0afae51e085 /plugins
parentfe50701280c9005d220d9c6eee78afc40fb59865 (diff)
parentfe8ac119f75bc6d2763896b8e1a85ecfeb41bffb (diff)
downloadrsyslog-fdcaca6b85d65ef2c9b4814cc4a9adda4568e24f.tar.gz
rsyslog-fdcaca6b85d65ef2c9b4814cc4a9adda4568e24f.tar.xz
rsyslog-fdcaca6b85d65ef2c9b4814cc4a9adda4568e24f.zip
Merge branch 'v5-stable' into v5-beta
Conflicts: ChangeLog configure.ac doc/manual.html
Diffstat (limited to 'plugins')
-rw-r--r--plugins/ommysql/ommysql.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/plugins/ommysql/ommysql.c b/plugins/ommysql/ommysql.c
index 58e347bf..7ff89f5a 100644
--- a/plugins/ommysql/ommysql.c
+++ b/plugins/ommysql/ommysql.c
@@ -90,7 +90,6 @@ static void closeMySQL(instanceData *pData)
ASSERT(pData != NULL);
if(pData->f_hmysql != NULL) { /* just to be on the safe side... */
- mysql_server_end();
mysql_close(pData->f_hmysql);
pData->f_hmysql = NULL;
}
@@ -319,6 +318,11 @@ ENDparseSelectorAct
BEGINmodExit
CODESTARTmodExit
+# ifdef HAVE_MYSQL_LIBRARY_INIT
+ mysql_library_end();
+# else
+ mysql_server_end();
+# endif
ENDmodExit
@@ -346,6 +350,20 @@ CODESTARTmodInit
*ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */
CODEmodInit_QueryRegCFSLineHdlr
CHKiRet(objUse(errmsg, CORE_COMPONENT));
+
+ /* we need to init the MySQL library. If that fails, we cannot run */
+ if(
+# ifdef HAVE_MYSQL_LIBRARY_INIT
+ mysql_library_init(0, NULL, NULL)
+# else
+ mysql_server_init(0, NULL, NULL)
+# endif
+ ) {
+ errmsg.LogError(0, NO_ERRCODE, "ommysql: mysql_server_init() failed, plugin "
+ "can not run");
+ ABORT_FINALIZE(RS_RET_ERR);
+ }
+
/* register our config handlers */
CHKiRet(omsdRegCFSLineHdlr((uchar *)"actionommysqlserverport", 0, eCmdHdlrInt, NULL, &iSrvPort, STD_LOADABLE_MODULE_ID));
CHKiRet(omsdRegCFSLineHdlr((uchar *)"resetconfigvariables", 1, eCmdHdlrCustomHandler, resetConfigVariables, NULL, STD_LOADABLE_MODULE_ID));