summaryrefslogtreecommitdiffstats
path: root/cfsysline.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2007-07-31 08:40:32 +0000
committerRainer Gerhards <rgerhards@adiscon.com>2007-07-31 08:40:32 +0000
commitc0b2b6b1bf3735bb0570523c9529bb1f93e96b86 (patch)
tree10c28775f661259666da1f7b76cdbe74dd5b7000 /cfsysline.c
parent9c20d0b4b4d3b85128d1754af3324866b135a412 (diff)
downloadrsyslog-c0b2b6b1bf3735bb0570523c9529bb1f93e96b86.tar.gz
rsyslog-c0b2b6b1bf3735bb0570523c9529bb1f93e96b86.tar.xz
rsyslog-c0b2b6b1bf3735bb0570523c9529bb1f93e96b86.zip
- added macro to abort a function and go to finalizer
- added output of config file line number when a parsing error occured
Diffstat (limited to 'cfsysline.c')
-rw-r--r--cfsysline.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/cfsysline.c b/cfsysline.c
index 5119df02..1a045321 100644
--- a/cfsysline.c
+++ b/cfsysline.c
@@ -98,8 +98,7 @@ rsRetVal doGetInt(uchar **pp, rsRetVal (*pSetHdlr)(void*, uid_t), void *pVal)
if(!isdigit((int) *p)) {
errno = 0;
logerror("invalid number");
- iRet = RS_RET_INVALID_INT;
- goto finalize_it;
+ ABORT_FINALIZE(RS_RET_INVALID_INT);
}
/* pull value */
@@ -158,8 +157,7 @@ rsRetVal doFileCreateMode(uchar **pp, rsRetVal (*pSetHdlr)(void*, uid_t), void *
"value must be octal (e.g 0644).");
errno = 0;
logerror((char*) errMsg);
- iRet = RS_RET_INVALID_VALUE;
- goto finalize_it;
+ ABORT_FINALIZE(RS_RET_INVALID_VALUE);
}
/* we reach this code only if the octal number is ok - so we can now
@@ -234,8 +232,7 @@ rsRetVal doGetGID(uchar **pp, rsRetVal (*pSetHdlr)(void*, uid_t), void *pVal)
if(getSubString(pp, (char*) szName, sizeof(szName) / sizeof(uchar), ' ') != 0) {
logerror("could not extract group name");
- iRet = RS_RET_NOT_FOUND;
- goto finalize_it;
+ ABORT_FINALIZE(RS_RET_NOT_FOUND);
}
getgrnam_r((char*)szName, &gBuf, stringBuf, sizeof(stringBuf), &pgBuf);
@@ -277,8 +274,7 @@ rsRetVal doGetUID(uchar **pp, rsRetVal (*pSetHdlr)(void*, uid_t), void *pVal)
if(getSubString(pp, (char*) szName, sizeof(szName) / sizeof(uchar), ' ') != 0) {
logerror("could not extract user name");
- iRet = RS_RET_NOT_FOUND;
- goto finalize_it;
+ ABORT_FINALIZE(RS_RET_NOT_FOUND);
}
getpwnam_r((char*)szName, &pwBuf, stringBuf, sizeof(stringBuf), &ppwBuf);
@@ -357,11 +353,10 @@ rsRetVal cslchConstruct(cslCmdHdlr_t **ppThis)
assert(ppThis != NULL);
if((pThis = calloc(1, sizeof(cslCmdHdlr_t))) == NULL) {
- iRet = RS_RET_OUT_OF_MEMORY;
- goto abort_it;
+ ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY);
}
-abort_it:
+finalize_it:
*ppThis = pThis;
return iRet;
}