reset head on wrap when buffer empty

Reported-By: David Jeffery <[email protected]>
---
 usr/log.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/usr/log.c b/usr/log.c
index 26c61d847793..b730642779bf 100644
--- a/usr/log.c
+++ b/usr/log.c
@@ -189,6 +189,9 @@ int log_enqueue (int prio, const char * fmt, va_list ap)
            (len + sizeof(struct logmsg)) > (la->end - la->tail)) {
                logdbg(stderr, "enqueue: rewind tail to %p\n", la->tail);
                        la->tail = la->start;
+
+                       if (la->empty)
+                               la->head = lastmsg = la->tail;
        }
 
        /* not enough space on head : drop msg */
-- 
2.14.4

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to