diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2009-06-22 18:52:50 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2009-06-22 18:52:50 +0200 |
commit | 06e59df5ded6fa51becb3abe14430027c72f1088 (patch) | |
tree | 1af0564e9698a43a7fbb3a1b053649337e254c97 /tools | |
parent | d61bcbbd0e99a8ffadfe1e0c5347dee9e04a0b1d (diff) | |
parent | ce5869f7c41c8db943d8cbe804b69af40d43e2e6 (diff) | |
download | rsyslog-06e59df5ded6fa51becb3abe14430027c72f1088.tar.gz rsyslog-06e59df5ded6fa51becb3abe14430027c72f1088.tar.xz rsyslog-06e59df5ded6fa51becb3abe14430027c72f1088.zip |
Merge branch 'omfile' into v5-devel
Diffstat (limited to 'tools')
-rw-r--r-- | tools/syslogd.c | 26 |
1 files changed, 10 insertions, 16 deletions
diff --git a/tools/syslogd.c b/tools/syslogd.c index 5cf94da8..8b966e8a 100644 --- a/tools/syslogd.c +++ b/tools/syslogd.c @@ -1416,9 +1416,9 @@ int parseLegacySyslogMsg(msg_t *pMsg, int flags) uchar *p2parse; char *pBuf; char *pWork; - cstr_t *pStrB; - int iCnt; int bTAGCharDetected; + int i; /* general index for parsing */ + uchar bufParseTAG[CONF_TAG_MAXSIZE]; BEGINfunc assert(pMsg != NULL); @@ -1536,23 +1536,16 @@ 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) { - uchar *pszTAG; - if(cstrConstruct(&pStrB) != RS_RET_OK) - return 1; - rsCStrSetAllocIncrement(pStrB, 33); - pWork = pBuf; - iCnt = 0; - while(*p2parse && *p2parse != ':' && *p2parse != ' ') { - cstrAppendChar(pStrB, *p2parse++); - ++iCnt; + i = 0; + while(*p2parse && *p2parse != ':' && *p2parse != ' ' && i < CONF_TAG_MAXSIZE) { + bufParseTAG[i++] = *p2parse++; } if(*p2parse == ':') { ++p2parse; - cstrAppendChar(pStrB, ':'); + bufParseTAG[i++] = ':'; } - cstrFinalize(pStrB); - cstrConvSzStrAndDestruct(pStrB, &pszTAG, 1); - if(pszTAG == NULL) + + if(i == 0) { /* rger, 2005-11-10: no TAG found - this implies that what * we have considered to be the HOSTNAME is most probably the * TAG. We consider it so probable, that we now adjust it @@ -1565,7 +1558,8 @@ int parseLegacySyslogMsg(msg_t *pMsg, int flags) moveHOSTNAMEtoTAG(pMsg); MsgSetHOSTNAME(pMsg, getRcvFrom(pMsg)); } else { /* we have a TAG, so we can happily set it ;) */ - MsgAssignTAG(pMsg, pszTAG); + bufParseTAG[i] = '\0'; /* terminate string */ + MsgSetTAG(pMsg, bufParseTAG, i); } } else { /* we have no TAG, so we ... */ |