From: Luke Heberling Date: Thu, 13 Dec 2007 07:06:26 +0000 (+0100) Subject: rc/utils_llist.c: Fix a bug in llist_prepend. X-Git-Tag: collectd-4.2.2~3 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=65cbd6ca1da0d802ac39b460dcb8ae0af3762c13;p=collectd.git rc/utils_llist.c: Fix a bug in llist_prepend. Copy the element to the tail if it's the first element. --- diff --git a/src/utils_llist.c b/src/utils_llist.c index d8694e3f..d5db9dc0 100644 --- a/src/utils_llist.c +++ b/src/utils_llist.c @@ -110,6 +110,9 @@ void llist_prepend (llist_t *l, llentry_t *e) { e->next = l->head; l->head = e; + + if (l->tail == NULL) + l->tail = e; } void llist_remove (llist_t *l, llentry_t *e)