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 /outchannel.c | |
parent | 0dc7ddd0ea702857c1d5512826e222212b634cb5 (diff) | |
download | rsyslog-82aeadce540240396d13d3355d4ef04e3524acbf.tar.gz rsyslog-82aeadce540240396d13d3355d4ef04e3524acbf.tar.xz 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 'outchannel.c')
-rw-r--r-- | outchannel.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/outchannel.c b/outchannel.c index a713680f..0427a4a4 100644 --- a/outchannel.c +++ b/outchannel.c @@ -78,7 +78,7 @@ static void skip_Comma(char **pp) * is "eaten" and does not become part of the field content. * returns: 0 - ok, 1 - failure */ -static int get_Field(uchar **pp, char **pField) +static int get_Field(uchar **pp, uchar **pField) { register uchar *p; rsCStrObj *pStrB; @@ -101,7 +101,8 @@ static int get_Field(uchar **pp, char **pField) *pp = p; rsCStrFinish(pStrB); - *pField = (char*)rsCStrConvSzStrAndDestruct(pStrB); + if(rsCStrConvSzStrAndDestruct(pStrB, pField, 0) != RS_RET_OK) + return 1; return 0; } @@ -142,7 +143,7 @@ static int get_off_t(uchar **pp, off_t *pOff_t) * not trailing. * returns: 0 - ok, 1 - failure */ -static inline int get_restOfLine(uchar **pp, char **pBuf) +static inline int get_restOfLine(uchar **pp, uchar **pBuf) { register uchar *p; rsCStrObj *pStrB; @@ -165,7 +166,8 @@ static inline int get_restOfLine(uchar **pp, char **pBuf) *pp = p; rsCStrFinish(pStrB); - *pBuf = (char*) rsCStrConvSzStrAndDestruct(pStrB); + if(rsCStrConvSzStrAndDestruct(pStrB, pBuf, 0) != RS_RET_OK) + return 1; return 0; } @@ -268,9 +270,9 @@ void ochPrintList(void) pOch = ochRoot; while(pOch != NULL) { dbgprintf("Outchannel: Name='%s'\n", pOch->pszName == NULL? "NULL" : pOch->pszName); - dbgprintf("\tFile Template: '%s'\n", pOch->pszFileTemplate == NULL ? "NULL" : pOch->pszFileTemplate); + dbgprintf("\tFile Template: '%s'\n", pOch->pszFileTemplate == NULL ? "NULL" : (char*) pOch->pszFileTemplate); dbgprintf("\tMax Size.....: %lu\n", pOch->uSizeLimit); - dbgprintf("\tOnSizeLimtCmd: '%s'\n", pOch->cmdOnSizeLimit == NULL ? "NULL" : pOch->cmdOnSizeLimit); + dbgprintf("\tOnSizeLimtCmd: '%s'\n", pOch->cmdOnSizeLimit == NULL ? "NULL" : (char*) pOch->cmdOnSizeLimit); pOch = pOch->pNext; /* done, go next */ } } |