summaryrefslogtreecommitdiffstats
path: root/modules.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-03-05 14:53:25 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2008-03-05 14:53:25 +0000
commit24b02dc831889986211600a75572737e733ef9d8 (patch)
tree50e1525e5749c8b6e51969d8ff88060a172b0497 /modules.c
parent213e0b596205626214891fb46e1a780af7f26a8b (diff)
downloadrsyslog-24b02dc831889986211600a75572737e733ef9d8.tar.gz
rsyslog-24b02dc831889986211600a75572737e733ef9d8.tar.xz
rsyslog-24b02dc831889986211600a75572737e733ef9d8.zip
- extracted logerror*() family of functions from syslogd, made them their
own class and converted to new object calling conventions (interface-based) - converted gss-misc into a loadable library module
Diffstat (limited to 'modules.c')
-rw-r--r--modules.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/modules.c b/modules.c
index cdaa2433..40e3b080 100644
--- a/modules.c
+++ b/modules.c
@@ -41,13 +41,14 @@
#include "syslogd.h"
#include "cfsysline.h"
#include "modules.h"
+#include "errmsg.h"
/* static data */
DEFobjStaticHelpers
+DEFobjCurrIf(errmsg)
static modInfo_t *pLoadedModules = NULL; /* list of currently-loaded modules */
static modInfo_t *pLoadedModulesLast = NULL; /* tail-pointer */
-static int bCfsyslineInitialized = 0;
/* config settings */
uchar *pModDir = NULL; /* read-only after startup */
@@ -224,12 +225,6 @@ doModInit(rsRetVal (*modInit)(int, int*, rsRetVal(**)(), rsRetVal(*)()), uchar *
assert(modInit != NULL);
- if(bCfsyslineInitialized == 0) {
- /* we need to initialize the cfsysline subsystem first */
- CHKiRet(cfsyslineInit());
- bCfsyslineInitialized = 1;
- }
-
if((iRet = moduleConstruct(&pNew)) != RS_RET_OK) {
pNew = NULL;
ABORT_FINALIZE(iRet);
@@ -471,20 +466,20 @@ Load(uchar *pModName)
if(!(pModHdlr = dlopen((char *) szPath, RTLD_NOW))) {
snprintf((char *) errMsg, sizeof(errMsg), "could not load module '%s', dlopen: %s\n", szPath, dlerror());
errMsg[sizeof(errMsg)/sizeof(uchar) - 1] = '\0';
- logerror((char *) errMsg);
+ errmsg.LogError(NO_ERRCODE, "%s", errMsg);
ABORT_FINALIZE(RS_RET_ERR);
}
if(!(pModInit = dlsym(pModHdlr, "modInit"))) {
snprintf((char *) errMsg, sizeof(errMsg), "could not load module '%s', dlsym: %s\n", szPath, dlerror());
errMsg[sizeof(errMsg)/sizeof(uchar) - 1] = '\0';
- logerror((char *) errMsg);
+ errmsg.LogError(NO_ERRCODE, "%s", errMsg);
dlclose(pModHdlr);
ABORT_FINALIZE(RS_RET_ERR);
}
if((iRet = doModInit(pModInit, (uchar*) pModName, pModHdlr)) != RS_RET_OK) {
snprintf((char *) errMsg, sizeof(errMsg), "could not load module '%s', rsyslog error %d\n", szPath, iRet);
errMsg[sizeof(errMsg)/sizeof(uchar) - 1] = '\0';
- logerror((char *) errMsg);
+ errmsg.LogError(NO_ERRCODE, "%s", errMsg);
dlclose(pModHdlr);
ABORT_FINALIZE(RS_RET_ERR);
}
@@ -527,6 +522,7 @@ ENDobjQueryInterface(module)
*/
BEGINAbstractObjClassInit(module, 1, OBJ_IS_CORE_MODULE) /* class, version - CHANGE class also in END MACRO! */
/* request objects we use */
+ CHKiRet(objUse(errmsg, CORE_COMPONENT));
ENDObjClassInit(module)
/* vi:set ai: