From 680b9daadac4954ac6949f17bcf1889805811f09 Mon Sep 17 00:00:00 2001 From: compudj Date: Mon, 27 Mar 2006 16:46:21 +0000 Subject: [PATCH] fix off by one in buffer full condition git-svn-id: http://ltt.polymtl.ca/svn@1725 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt-usertrace/ltt-usertrace-fast.c | 2 +- ltt-usertrace/ltt/ltt-usertrace-fast.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ltt-usertrace/ltt-usertrace-fast.c b/ltt-usertrace/ltt-usertrace-fast.c index 1364d3bb..32dc7bbc 100644 --- a/ltt-usertrace/ltt-usertrace-fast.c +++ b/ltt-usertrace/ltt-usertrace-fast.c @@ -205,7 +205,7 @@ static void flush_buffer(struct ltt_buf *ltt_buf, enum force_switch_mode mode) index in the buffer being the one which will win this loop. */ /* If the buffer is not in overwrite mode, pushing the reader only happen if a sub-buffer is corrupted */ - if((SUBBUF_TRUNC(offset_end, ltt_buf) + if((SUBBUF_TRUNC(offset_end-1, ltt_buf) - SUBBUF_TRUNC(consumed_old, ltt_buf)) >= ltt_buf->alloc_size) consumed_new = SUBBUF_ALIGN(consumed_old, ltt_buf); diff --git a/ltt-usertrace/ltt/ltt-usertrace-fast.h b/ltt-usertrace/ltt/ltt-usertrace-fast.h index b0d222f8..778e8eb0 100644 --- a/ltt-usertrace/ltt/ltt-usertrace-fast.h +++ b/ltt-usertrace/ltt/ltt-usertrace-fast.h @@ -476,7 +476,7 @@ static inline void * __attribute__((no_instrument_function)) ltt_reserve_slot( index in the buffer being the one which will win this loop. */ /* If the buffer is not in overwrite mode, pushing the reader only happen if a sub-buffer is corrupted */ - if((SUBBUF_TRUNC(offset_end, ltt_buf) + if((SUBBUF_TRUNC(offset_end-1, ltt_buf) - SUBBUF_TRUNC(consumed_old, ltt_buf)) >= ltt_buf->alloc_size) consumed_new = SUBBUF_ALIGN(consumed_old, ltt_buf); -- 2.34.1