summaryrefslogtreecommitdiffstats
path: root/action.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2009-06-23 17:23:28 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2009-06-23 17:23:28 +0200
commita3e512f65f411bd0a4853d3dca9a3f3e6593e490 (patch)
treee68d6057b43388dccfd0c5c930619e977d26e856 /action.c
parent06e59df5ded6fa51becb3abe14430027c72f1088 (diff)
parentb2fa740b9ab5fb9e85309b3307f3fca21f625ab1 (diff)
downloadrsyslog-a3e512f65f411bd0a4853d3dca9a3f3e6593e490.tar.gz
rsyslog-a3e512f65f411bd0a4853d3dca9a3f3e6593e490.tar.xz
rsyslog-a3e512f65f411bd0a4853d3dca9a3f3e6593e490.zip
Merge branch 'omfile' into v5-devel
Conflicts: runtime/rsyslog.h
Diffstat (limited to 'action.c')
-rw-r--r--action.c20
1 files changed, 7 insertions, 13 deletions
diff --git a/action.c b/action.c
index 5d591a5d..09dd7df4 100644
--- a/action.c
+++ b/action.c
@@ -245,10 +245,7 @@ rsRetVal actionConstruct(action_t **ppThis)
ASSERT(ppThis != NULL);
- if((pThis = (action_t*) calloc(1, sizeof(action_t))) == NULL) {
- ABORT_FINALIZE(RS_RET_OUT_OF_MEMORY);
- }
-
+ CHKmalloc(pThis = (action_t*) calloc(1, sizeof(action_t)));
pThis->iResumeInterval = glbliActionResumeInterval;
pThis->iResumeRetryCount = glbliActionResumeRetryCount;
pThis->tLastOccur = time(NULL); /* done once per action on startup only */
@@ -1073,7 +1070,7 @@ actionWriteToAction(action_t *pAction)
if(pAction->iNbrNoExec < pAction->iExecEveryNthOccur - 1) {
++pAction->iNbrNoExec;
dbgprintf("action %p passed %d times to execution - less than neded - discarding\n",
- pAction, pAction->iNbrNoExec);
+ pAction, pAction->iNbrNoExec);
FINALIZE;
} else {
pAction->iNbrNoExec = 0; /* we execute the action now, so the number of no execs is down to */
@@ -1090,6 +1087,7 @@ actionWriteToAction(action_t *pAction)
*/
if(pAction->f_prevcount > 1) {
msg_t *pMsg;
+ size_t lenRepMsg;
uchar szRepMsg[1024];
if((pMsg = MsgDup(pAction->f_pMsg)) == NULL) {
@@ -1099,23 +1097,19 @@ actionWriteToAction(action_t *pAction)
}
if(pAction->bRepMsgHasMsg == 0) { /* old format repeat message? */
- snprintf((char*)szRepMsg, sizeof(szRepMsg), "last message repeated %d times",
+ lenRepMsg = snprintf((char*)szRepMsg, sizeof(szRepMsg), " last message repeated %d times",
pAction->f_prevcount);
} else {
- snprintf((char*)szRepMsg, sizeof(szRepMsg), "message repeated %d times: [%.800s]",
+ lenRepMsg = snprintf((char*)szRepMsg, sizeof(szRepMsg), " message repeated %d times: [%.800s]",
pAction->f_prevcount, getMSG(pAction->f_pMsg));
}
- /* We now need to update the other message properties.
- * ... RAWMSG is a problem ... Please note that digital
+ /* We now need to update the other message properties. Please note that digital
* signatures inside the message are also invalidated.
*/
datetime.getCurrTime(&(pMsg->tRcvdAt), &(pMsg->ttGenTime));
memcpy(&pMsg->tTIMESTAMP, &pMsg->tRcvdAt, sizeof(struct syslogTime));
-#pragma warn "need fix msg repeationg handling"
- //MsgSetMSG(pMsg, (char*)szRepMsg);
- MsgSetRawMsgWOSize(pMsg, (char*)szRepMsg);
-
+ MsgReplaceMSG(pMsg, szRepMsg, lenRepMsg);
pMsgSave = pAction->f_pMsg; /* save message pointer for later restoration */
pAction->f_pMsg = pMsg; /* use the new msg (pointer will be restored below) */
}