summaryrefslogtreecommitdiffstats
path: root/runtime/conf.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2010-07-27 13:38:51 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2010-07-27 13:38:51 +0200
commitf02d77f4b45d0a5a0ce86a87f056c91de1e4b731 (patch)
tree4929ad906e15b435ce84307bbcf967cfceda353f /runtime/conf.c
parent8d55f7a6317150e48ba5eeda20d7c64f978ab974 (diff)
downloadrsyslog-f02d77f4b45d0a5a0ce86a87f056c91de1e4b731.tar.gz
rsyslog-f02d77f4b45d0a5a0ce86a87f056c91de1e4b731.tar.xz
rsyslog-f02d77f4b45d0a5a0ce86a87f056c91de1e4b731.zip
final (?) milestone: looks like action scoping works now
but doc and testing is missing!
Diffstat (limited to 'runtime/conf.c')
-rw-r--r--runtime/conf.c35
1 files changed, 34 insertions, 1 deletions
diff --git a/runtime/conf.c b/runtime/conf.c
index c4c72ec2..1d80c867 100644
--- a/runtime/conf.c
+++ b/runtime/conf.c
@@ -1263,11 +1263,44 @@ static inline rsRetVal
setActionScope(void)
{
DEFiRet;
+ modInfo_t *pMod;
currConfObj = eConfObjAction;
DBGPRINTF("entering action scope\n");
CHKiRet(actionNewScope());
+ /* now tell each action to start the scope */
+ pMod = NULL;
+ while((pMod = module.GetNxtType(pMod, eMOD_OUT)) != NULL) {
+ DBGPRINTF("beginning scope on module %s\n", pMod->pszName);
+ pMod->mod.om.newScope();
+ }
+
+finalize_it:
+ RETiRet;
+}
+
+
+/* switch back from action scope.
+ * rgerhards, 2010-07-27
+ */
+static inline rsRetVal
+unsetActionScope(void)
+{
+ DEFiRet;
+ modInfo_t *pMod;
+
+ currConfObj = eConfObjAction;
+ DBGPRINTF("exiting action scope\n");
+ CHKiRet(actionRestoreScope());
+
+ /* now tell each action to restore the scope */
+ pMod = NULL;
+ while((pMod = module.GetNxtType(pMod, eMOD_OUT)) != NULL) {
+ DBGPRINTF("exiting scope on module %s\n", pMod->pszName);
+ pMod->mod.om.restoreScope();
+ }
+
finalize_it:
RETiRet;
}
@@ -1324,7 +1357,7 @@ endConfObj(void __attribute__((unused)) *pVal, uchar *pszName)
ABORT_FINALIZE(RS_RET_CONF_INVLD_END);
}
currConfObj = eConfObjGlobal;
- CHKiRet(actionRestoreScope());
+ CHKiRet(unsetActionScope());
} else {
errmsg.LogError(0, RS_RET_INVLD_CONF_OBJ, "invalid config object \"%s\" in $End", pszName);
ABORT_FINALIZE(RS_RET_INVLD_CONF_OBJ);