summaryrefslogtreecommitdiffstats
path: root/runtime/msg.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2008-07-18 14:51:49 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2008-07-18 14:51:49 +0200
commitd45a286f2dee3c3d5aefef1ac16a02578c95f574 (patch)
tree9a6dc8ff9fbf7feea6db3eb4a17f0c21c2efb9fb /runtime/msg.c
parentc01ed77e5085baec0ad0a8c6ffcb32f11b6939e8 (diff)
parent73abfd1fad59ffc426072bac779e4c0f4c712619 (diff)
downloadrsyslog-d45a286f2dee3c3d5aefef1ac16a02578c95f574.tar.gz
rsyslog-d45a286f2dee3c3d5aefef1ac16a02578c95f574.tar.xz
rsyslog-d45a286f2dee3c3d5aefef1ac16a02578c95f574.zip
Merge branch 'v3-stable' into beta
Conflicts: doc/property_replacer.html tools/syslogd.c
Diffstat (limited to 'runtime/msg.c')
-rw-r--r--runtime/msg.c26
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).