[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 4/6] Fix a counter bug in the log buffer



* src/util/logging.c: the start pointer need to wrap around too

Signed-off-by: Daniel Veillard <veillard redhat com>
---
 src/util/logging.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/util/logging.c b/src/util/logging.c
index 33b0992..b946285 100644
--- a/src/util/logging.c
+++ b/src/util/logging.c
@@ -271,6 +271,8 @@ static void virLogStr(const char *str, int len) {
         tmp = virLogLen - LOG_BUFFER_SIZE;
         virLogLen = LOG_BUFFER_SIZE;
         virLogStart += tmp;
+        if (virLogStart >= LOG_BUFFER_SIZE)
+            virLogStart -= LOG_BUFFER_SIZE;
     }
     virLogUnlock();
 }

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]