diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2010-04-07 12:42:41 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2010-04-07 12:42:41 +0200 |
commit | 2cd132eebb84dbcffcf0c20b9354c14f797c29cd (patch) | |
tree | 8bf071c79b8d274179884113cb12ac4ce1328847 /runtime/parser.c | |
parent | 23a3fdb094cd992b2081db014d583b975c03ca57 (diff) | |
download | rsyslog-2cd132eebb84dbcffcf0c20b9354c14f797c29cd.tar.gz rsyslog-2cd132eebb84dbcffcf0c20b9354c14f797c29cd.tar.xz rsyslog-2cd132eebb84dbcffcf0c20b9354c14f797c29cd.zip |
enhanced nettester tool so that it re-uses it's callers environment
this enables us to work with the "usual" environment tweaks (for
debugging and other purposes), without the need for any special
handling in nettester itself
Diffstat (limited to 'runtime/parser.c')
-rw-r--r-- | runtime/parser.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/runtime/parser.c b/runtime/parser.c index 466066e7..36e88ebd 100644 --- a/runtime/parser.c +++ b/runtime/parser.c @@ -176,7 +176,10 @@ sanitizeMessage(msg_t *pMsg) pszMsg = pMsg->pszRawMsg; lenMsg = pMsg->iLenRawMsg; - /* remove NUL character at end of message (see comment in function header) */ + /* remove NUL character at end of message (see comment in function header) + * Note that we do not need to add a NUL character in this case, because it + * is already present ;) + */ if(pszMsg[lenMsg-1] == '\0') { DBGPRINTF("dropped NUL at very end of message\n"); bUpdatedLen = TRUE; @@ -190,8 +193,9 @@ sanitizeMessage(msg_t *pMsg) */ if(bDropTrailingLF && pszMsg[lenMsg-1] == '\n') { DBGPRINTF("dropped LF at very end of message (DropTrailingLF is set)\n"); - bUpdatedLen = TRUE; lenMsg--; + pszMsg[lenMsg] = '\0'; + bUpdatedLen = TRUE; } /* it is much quicker to sweep over the message and see if it actually @@ -245,6 +249,7 @@ sanitizeMessage(msg_t *pMsg) } ++iSrc; } + pDst[iDst] = '\0'; MsgSetRawMsg(pMsg, (char*)pDst, iDst); /* save sanitized string */ |