diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2008-07-18 15:46:00 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2008-07-18 15:46:00 +0200 |
commit | 71e4eebdf1f34c9fb10b3a8d7462ad624f740c10 (patch) | |
tree | 01d71323e0bac815f92191f5b7e36d899aed7d18 /runtime | |
parent | 37bac26f6edb2104829ed1b97061753530ecbdf8 (diff) | |
parent | d45a286f2dee3c3d5aefef1ac16a02578c95f574 (diff) | |
download | rsyslog-71e4eebdf1f34c9fb10b3a8d7462ad624f740c10.tar.gz rsyslog-71e4eebdf1f34c9fb10b3a8d7462ad624f740c10.tar.xz rsyslog-71e4eebdf1f34c9fb10b3a8d7462ad624f740c10.zip |
Merge branch 'beta'
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/msg.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/runtime/msg.c b/runtime/msg.c index a5881f50..fdeae077 100644 --- a/runtime/msg.c +++ b/runtime/msg.c @@ -1988,6 +1988,32 @@ char *MsgGetProp(msg_t *pMsg, struct templateEntry *pTpe, #endif /* #ifdef FEATURE_REGEXP */ } + /* now check if we need to do our "SP if first char is non-space" hack logic */ + if(*pRes && pTpe->data.field.options.bSPIffNo1stSP) { + char *pB; + uchar cFirst = *pRes; + + /* here, we always destruct the buffer and return a new one */ + pB = (char *) malloc(2 * sizeof(char)); + if(pB == NULL) { + if(*pbMustBeFreed == 1) + free(pRes); + *pbMustBeFreed = 0; + return "**OUT OF MEMORY**"; + } + pRes = pB; + *pbMustBeFreed = 1; + + if(cFirst == ' ') { + /* if we have a SP, we must return an empty string */ + *pRes = '\0'; /* empty */ + } else { + /* if it is no SP, we need to return one */ + *pRes = ' '; + *(pRes+1) = '\0'; + } + } + if(*pRes) { /* case conversations (should go after substring, because so we are able to * work on the smallest possible buffer). |