diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2008-04-17 09:07:12 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2008-04-17 09:07:12 +0200 |
commit | 87c936ab65b4381fed35689b38c98f130883d903 (patch) | |
tree | 460ca0e1481a62ab9a9728a7e56a74eceb8d2767 /plugins/imfile | |
parent | bf3e0d4f224a26e2ac9bc3edfd1e6eedcf56c9f8 (diff) | |
download | rsyslog-87c936ab65b4381fed35689b38c98f130883d903.tar.gz rsyslog-87c936ab65b4381fed35689b38c98f130883d903.tar.xz rsyslog-87c936ab65b4381fed35689b38c98f130883d903.zip |
modularization work
cleanup + created an abstract class for global data
items and moved glblGetWorkDir to it
Diffstat (limited to 'plugins/imfile')
-rw-r--r-- | plugins/imfile/imfile.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/plugins/imfile/imfile.c b/plugins/imfile/imfile.c index 925d0175..f95f9bc4 100644 --- a/plugins/imfile/imfile.c +++ b/plugins/imfile/imfile.c @@ -43,6 +43,7 @@ #include "msg.h" #include "stream.h" #include "errmsg.h" +#include "glbl.h" #include "datetime.h" MODULE_TYPE_INPUT /* must be present for input modules, do not remove */ @@ -52,6 +53,7 @@ MODULE_TYPE_INPUT /* must be present for input modules, do not remove */ /* Module static data */ DEF_IMOD_STATIC_DATA /* must be present, starts static data */ DEFobjCurrIf(errmsg) +DEFobjCurrIf(glbl) DEFobjCurrIf(datetime) typedef struct fileInfo_s { @@ -121,7 +123,7 @@ openFile(fileInfo_t *pThis) /* Construct file name */ lenSFNam = snprintf((char*)pszSFNam, sizeof(pszSFNam) / sizeof(uchar), "%s/%s", - (char*) glblGetWorkDir(), (char*)pThis->pszStateFile); + (char*) glbl.GetWorkDir(), (char*)pThis->pszStateFile); /* check if the file exists */ if(stat((char*) pszSFNam, &stat_buf) == -1) { @@ -334,7 +336,7 @@ persistStrmState(fileInfo_t *pInfo) /* TODO: create a function persistObj in obj.c? */ CHKiRet(strmConstruct(&psSF)); - CHKiRet(strmSetDir(psSF, glblGetWorkDir(), strlen((char*)glblGetWorkDir()))); + CHKiRet(strmSetDir(psSF, glbl.GetWorkDir(), strlen((char*)glbl.GetWorkDir()))); CHKiRet(strmSettOperationsMode(psSF, STREAMMODE_WRITE)); CHKiRet(strmSetiAddtlOpenFlags(psSF, O_TRUNC)); CHKiRet(strmSetsType(psSF, STREAMTYPE_FILE_SINGLE)); @@ -381,6 +383,7 @@ BEGINmodExit CODESTARTmodExit /* release objects we used */ objRelease(datetime, CORE_COMPONENT); + objRelease(glbl, CORE_COMPONENT); objRelease(errmsg, CORE_COMPONENT); ENDmodExit @@ -488,6 +491,7 @@ CODESTARTmodInit *ipIFVersProvided = CURR_MOD_IF_VERSION; /* we only support the current interface specification */ CODEmodInit_QueryRegCFSLineHdlr CHKiRet(objUse(errmsg, CORE_COMPONENT)); + CHKiRet(objUse(glbl, CORE_COMPONENT)); CHKiRet(objUse(datetime, CORE_COMPONENT)); CHKiRet(omsdRegCFSLineHdlr((uchar *)"inputfilename", 0, eCmdHdlrGetWord, |