diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2007-09-05 15:59:47 +0000 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2007-09-05 15:59:47 +0000 |
commit | 82aeadce540240396d13d3355d4ef04e3524acbf (patch) | |
tree | f2c3372b68174739ed31ed98c52cf6fcce4f9e89 /syslogd.c | |
parent | 0dc7ddd0ea702857c1d5512826e222212b634cb5 (diff) | |
download | rsyslog-82aeadce540240396d13d3355d4ef04e3524acbf.tar.gz rsyslog-82aeadce540240396d13d3355d4ef04e3524acbf.tar.bz2 rsyslog-82aeadce540240396d13d3355d4ef04e3524acbf.zip |
- changed part of the CStr interface so that better error tracking is
provided and the calling sequence is more intuitive (there were invalid
calls based on a too-weired interface)
- (hopefully) fixed some remaining bugs rooted in wrong use of the CStr
class. These could lead to program abort.
Diffstat (limited to 'syslogd.c')
-rw-r--r-- | syslogd.c | 17 |
1 files changed, 6 insertions, 11 deletions
@@ -3103,7 +3103,7 @@ static int parseLegacySyslogMsg(msg_t *pMsg, int flags) * is the max size ;) we need to shuffle the code again... Just for * the records: the code is currently clean, but we could optimize it! */ if(!bTAGCharDetected) { - char *pszTAG; + uchar *pszTAG; if((pStrB = rsCStrConstruct()) == NULL) return 1; rsCStrSetAllocIncrement(pStrB, 33); @@ -3119,7 +3119,7 @@ static int parseLegacySyslogMsg(msg_t *pMsg, int flags) } rsCStrFinish(pStrB); - pszTAG = (char*) rsCStrConvSzStrAndDestruct(pStrB); + rsCStrConvSzStrAndDestruct(pStrB, &pszTAG, 1); if(pszTAG == NULL) { /* rger, 2005-11-10: no TAG found - this implies that what * we have considered to be the HOSTNAME is most probably the @@ -3310,12 +3310,7 @@ rsRetVal fprintlog(action_t *pAction) /* here we must loop to process all requested strings */ for(i = 0 ; i < pAction->iNumTpls ; ++i) { - if((pAction->ppMsgs[i] = tplToString(pAction->ppTpl[i], pAction->f_pMsg)) == NULL) { - dbgprintf("memory alloc failed while generating message strings - message ignored\n"); - glblHadMemShortage = 1; - iRet = RS_RET_OUT_OF_MEMORY; - goto finalize_it; - } + CHKiRet(tplToString(pAction->ppTpl[i], pAction->f_pMsg, &pAction->ppMsgs[i])); } /* call configured action */ iRet = pAction->pMod->mod.om.doAction(pAction->ppMsgs, pAction->f_pMsg->msgFlags, pAction->pModData); @@ -4473,11 +4468,11 @@ rsRetVal cflineParseTemplateName(uchar** pp, omodStringRequest_t *pOMSR, int iEn /* now copy the string */ while(*p && *p != '#' && !isspace((int) *p)) { - if((iRet = rsCStrAppendChar(pStrB, *p)) != RS_RET_OK) goto finalize_it; + CHKiRet(rsCStrAppendChar(pStrB, *p)); ++p; } - if((iRet = rsCStrFinish(pStrB)) != RS_RET_OK) goto finalize_it; - tplName = rsCStrConvSzStrAndDestruct(pStrB); + CHKiRet(rsCStrFinish(pStrB)); + CHKiRet(rsCStrConvSzStrAndDestruct(pStrB, &tplName, 0)); } iRet = OMSRsetEntry(pOMSR, iEntry, tplName, iTplOpts); |