summaryrefslogtreecommitdiffstats
path: root/action.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2010-01-26 16:54:35 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2010-01-26 16:54:35 +0100
commitbab3ee566c883ac88df369ec32df0c9100f97343 (patch)
tree990a9a74056e72583ac56a580a5dfeabd14dba77 /action.c
parenteac8ef081b6058e6d21943683d19519709fab55c (diff)
downloadrsyslog-bab3ee566c883ac88df369ec32df0c9100f97343.tar.gz
rsyslog-bab3ee566c883ac88df369ec32df0c9100f97343.tar.xz
rsyslog-bab3ee566c883ac88df369ec32df0c9100f97343.zip
bugfix: queues in direct mode could case a segfault,...
especially if an action failed for action queues. The issue was an invalid increment of a stack-based pointer which lead to destruction of the stack frame and thus a segfault on function return. Thanks to Michael Biebl for alerting us on this problem.
Diffstat (limited to 'action.c')
-rw-r--r--action.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/action.c b/action.c
index b3600e4f..e9d0def4 100644
--- a/action.c
+++ b/action.c
@@ -901,7 +901,6 @@ submitBatch(action_t *pAction, batch_t *pBatch, int nElem, int *pbShutdownImmedi
bDone = 0;
do {
localRet = tryDoAction(pAction, pBatch, &nElem, pbShutdownImmediate);
-dbgprintf("submitBatch: state of tryDoAction %d\n", localRet);
if(localRet == RS_RET_FORCE_TERM)
FINALIZE;
if( localRet == RS_RET_OK
@@ -925,12 +924,13 @@ dbgprintf("submitBatch: state of tryDoAction %d\n", localRet);
} else if(localRet == RS_RET_ACTION_FAILED) {
/* in this case, the whole batch can not be processed */
for(i = 0 ; i < nElem ; ++i) {
- pBatch->pElem[++pBatch->iDoneUpTo].state = BATCH_STATE_BAD;
+ pBatch->pElem[pBatch->iDoneUpTo++].state = BATCH_STATE_BAD;
}
bDone = 1;
} else {
if(nElem == 1) {
- pBatch->pElem[++pBatch->iDoneUpTo].state = BATCH_STATE_BAD;
+ pBatch->pElem[pBatch->iDoneUpTo++].state = BATCH_STATE_BAD;
+// TODO: This is a mark, remove when no longer needed - Here was the bug, postincrement needs to be used, not preinc
bDone = 1;
} else {
/* retry with half as much. Depth is log_2 batchsize, so recursion is not too deep */