diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2012-05-03 18:28:54 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2012-05-03 18:28:54 +0200 |
commit | 4f70113457993c536fc948d5b3b3e69dc7a92a8a (patch) | |
tree | 5682fe05ddeb53f20a28e02c3190185ce763cd8d /plugins/ommysql/ommysql.c | |
parent | 6e28d86c6a0a0c5788c5cb263b71aab19eb54cb5 (diff) | |
parent | fe8ac119f75bc6d2763896b8e1a85ecfeb41bffb (diff) | |
download | rsyslog-4f70113457993c536fc948d5b3b3e69dc7a92a8a.tar.gz rsyslog-4f70113457993c536fc948d5b3b3e69dc7a92a8a.tar.xz rsyslog-4f70113457993c536fc948d5b3b3e69dc7a92a8a.zip |
Merge branch 'v5-stable' into v6-stable
Conflicts:
ChangeLog
configure.ac
doc/manual.html
Diffstat (limited to 'plugins/ommysql/ommysql.c')
-rw-r--r-- | plugins/ommysql/ommysql.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/plugins/ommysql/ommysql.c b/plugins/ommysql/ommysql.c index 41c8be65..79fd1b9e 100644 --- a/plugins/ommysql/ommysql.c +++ b/plugins/ommysql/ommysql.c @@ -100,7 +100,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; } @@ -329,6 +328,11 @@ ENDparseSelectorAct BEGINmodExit CODESTARTmodExit +# ifdef HAVE_MYSQL_LIBRARY_INIT + mysql_library_end(); +# else + mysql_server_end(); +# endif ENDmodExit @@ -357,6 +361,20 @@ SCOPINGmodInit *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, &cs.iSrvPort, STD_LOADABLE_MODULE_ID)); CHKiRet(omsdRegCFSLineHdlr((uchar *)"ommysqlconfigfile",0,eCmdHdlrGetWord,NULL,&cs.pszMySQLConfigFile,STD_LOADABLE_MODULE_ID)); |