summaryrefslogtreecommitdiffstats
path: root/template.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-10-16 08:45:57 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-10-16 08:45:57 +0200
commit1e0e9e67f073a4414ac03599b4ff8994ff30bc05 (patch)
tree947238856e69d5b248b6928ae455a034705dedda /template.c
parentcd118cfcc22ea283c8d0112aeedc3f0d8b42d8a8 (diff)
parent3ed4b2cd3ebaf6f4c377ba2e03ef52c2e8a985b6 (diff)
downloadrsyslog-1e0e9e67f073a4414ac03599b4ff8994ff30bc05.tar.gz
rsyslog-1e0e9e67f073a4414ac03599b4ff8994ff30bc05.tar.xz
rsyslog-1e0e9e67f073a4414ac03599b4ff8994ff30bc05.zip
Merge branch 'david-master' into master
Conflicts: ChangeLog runtime/msg.c
Diffstat (limited to 'template.c')
-rw-r--r--template.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/template.c b/template.c
index f3a8e057..1e0c9613 100644
--- a/template.c
+++ b/template.c
@@ -86,6 +86,7 @@ rsRetVal tplToString(struct template *pTpl, msg_t *pMsg, uchar **ppBuf, size_t *
unsigned short bMustBeFreed;
uchar *pVal;
size_t iLenVal;
+int propid = -1;
assert(pTpl != NULL);
assert(pMsg != NULL);
@@ -101,10 +102,12 @@ rsRetVal tplToString(struct template *pTpl, msg_t *pMsg, uchar **ppBuf, size_t *
iBuf = 0;
while(pTpe != NULL) {
if(pTpe->eEntryType == CONSTANT) {
+propid = -1;
pVal = (uchar*) pTpe->data.constant.pConstant;
iLenVal = pTpe->data.constant.iLenConstant;
bMustBeFreed = 0;
} else if(pTpe->eEntryType == FIELD) {
+propid = pTpe->data.field.propid;
pVal = (uchar*) MsgGetProp(pMsg, pTpe, pTpe->data.field.propid, &iLenVal, &bMustBeFreed);
/* we now need to check if we should use SQL option. In this case,
* we must go over the generated string and escape '\'' characters.
@@ -118,7 +121,8 @@ rsRetVal tplToString(struct template *pTpl, msg_t *pMsg, uchar **ppBuf, size_t *
doSQLEscape(&pVal, &iLenVal, &bMustBeFreed, 0);
}
/* got source, now copy over */
- if(iBuf + iLenVal + 1 >= *pLenBuf) /* we reserve one char for the final \0! */
+dbgprintf("copying prop id %3d (entry type %d) of length %d ('%s')\n", propid, pTpe->eEntryType, (int) iLenVal, pVal);
+ if(iBuf + iLenVal >= *pLenBuf) /* we reserve one char for the final \0! */
CHKiRet(ExtendBuf(ppBuf, pLenBuf, iBuf + iLenVal + 1));
if(iLenVal > 0) { /* may be zero depending on property */