Hi
* jeremie le-hen <[EMAIL PROTECTED]> 2003-10-06 16:44
> Unless I really drank too much yesterday evening, I'm pretty sure this
> algorithm will fail if the list has only one element, returning NULL
> immediately without even trying to compare the element.
> On the other hand, it seems to work pretty well for months, since it is
> widely used accross the NetFilter conntrack code. So where am I wrong ?
The code is correct.
Check include/linux/list.h, it's a cyclic list:
head->next points to first element
head->prev points to last element
the list iteration code will make it clear:
#define __list_for_each(pos, head) \
for (pos = (head)->next; pos != (head); pos = pos->next)
Regards
--
Thomas GRAF <[EMAIL PROTECTED]>
_______________________________________________
LARTC mailing list / [EMAIL PROTECTED]
http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/