From 052f8e2ef64ca039219ac83a9d9372f3eb3a5aed Mon Sep 17 00:00:00 2001 From: Rainer Gerhards Date: Thu, 21 Jul 2011 17:45:39 +0200 Subject: bugfix: abort in omfile (in brand-new code) --- grammar/parserif.h | 3 ++- grammar/rainerscript.c | 3 +++ grammar/rainerscript.h | 2 ++ runtime/module-template.h | 3 ++- runtime/rsconf.c | 8 ++++++-- 5 files changed, 15 insertions(+), 4 deletions(-) diff --git a/grammar/parserif.h b/grammar/parserif.h index 58b8fbdd..adb0f42f 100644 --- a/grammar/parserif.h +++ b/grammar/parserif.h @@ -3,10 +3,11 @@ #include "rainerscript.h" int cnfSetLexFile(char*); int yyparse(); -int yydebug; char *cnfcurrfn; void dbgprintf(char *fmt, ...) __attribute__((format(printf, 1, 2))); void parser_errmsg(char *fmt, ...) __attribute__((format(printf, 1, 2))); +extern int yydebug; +extern int yylineno; /* entry points to be called after the parser has processed the * element in question. Actual processing must than be done inside diff --git a/grammar/rainerscript.c b/grammar/rainerscript.c index 0b2ee7cb..43c5a677 100644 --- a/grammar/rainerscript.c +++ b/grammar/rainerscript.c @@ -449,6 +449,8 @@ cnfactlstNew(enum cnfactType actType, struct nvlst *lst, char *actLine) actlst->next = NULL; actlst->syslines = NULL; actlst->actType = actType; + actlst->lineno = yylineno; + actlst->cnfFile = strdup(cnfcurrfn); if(actType == CNFACT_V2) actlst->data.lst = lst; else @@ -484,6 +486,7 @@ cnfactlstDestruct(struct cnfactlst *actlst) while(actlst != NULL) { toDel = actlst; actlst = actlst->next; + free(toDel->cnfFile); cnfcfsyslinelstDestruct(toDel->syslines); if(toDel->actType == CNFACT_V2) nvlstDestruct(toDel->data.lst); diff --git a/grammar/rainerscript.h b/grammar/rainerscript.h index 7cc38abb..e11ae62f 100644 --- a/grammar/rainerscript.h +++ b/grammar/rainerscript.h @@ -86,6 +86,8 @@ struct cnfactlst { struct nvlst *lst; char *legActLine; } data; + char *cnfFile; + int lineno; }; /* the following structures support expressions, and may (very much later diff --git a/runtime/module-template.h b/runtime/module-template.h index 6238d0f4..d360447a 100644 --- a/runtime/module-template.h +++ b/runtime/module-template.h @@ -325,7 +325,8 @@ static rsRetVal newActInst(uchar __attribute__((unused)) *modName, \ struct nvlst *lst, void **ppModData, omodStringRequest_t **ppOMSR)\ {\ DEFiRet;\ - instanceData *pData = NULL; + instanceData *pData = NULL; \ + *ppOMSR = NULL; #define CODESTARTnewActInst \ diff --git a/runtime/rsconf.c b/runtime/rsconf.c index e85597f8..c4a0ed51 100644 --- a/runtime/rsconf.c +++ b/runtime/rsconf.c @@ -231,8 +231,12 @@ cnfDoActlst(struct cnfactlst *actlst, rule_t *pRule) dbgprintf("aclst %p: ", actlst); if(actlst->actType == CNFACT_V2) { dbgprintf("v6+ action object\n"); - actionNewInst(actlst->data.lst, &pAction); - iRet = llAppend(&(pRule)->llActList, NULL, (void*) pAction); + if(actionNewInst(actlst->data.lst, &pAction) == RS_RET_OK) { + iRet = llAppend(&(pRule)->llActList, NULL, (void*) pAction); + } else { + errmsg.LogError(0, RS_RET_ERR, "errors occured in file '%s' " + "around line %d", actlst->cnfFile, actlst->lineno); + } } else { dbgprintf("legacy action line:%s\n", actlst->data.legActLine); str = (uchar*) actlst->data.legActLine; -- cgit